notemend 0.1.29 → 0.1.30

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.
@@ -13,5 +13,5 @@
13
13
  "design-review",
14
14
  "mcp"
15
15
  ],
16
- "version": "0.1.29"
16
+ "version": "0.1.30"
17
17
  }
package/README.md CHANGED
@@ -188,8 +188,9 @@ Review a site the way you review a design file:
188
188
  - **Agents** — the round **Turbo** button is lit while an agent session listens (`/notemend:turbo`)
189
189
  and pauses or resumes it; **Push to Claude** sends the threads marked for the agent in one
190
190
  batch (right click picks which). A pin shows the agent at work the moment it takes a thread.
191
- - **Spaces** — a linked project keeps the studio's workspace and the clients' space apart (`M`
192
- switches); archived threads stay out of the way until shown (`A`).
191
+ - **Spaces** — a linked project keeps Team and Client apart (the menu in the top strip, `M`
192
+ switches); **Mirror to Team** in a client thread's `⋯` puts it in front of the team and the
193
+ agent, the client still its author; archived threads stay out of the way until shown (`A`).
193
194
  - **Voice and translation** — record a reply, or translate anyone's message into your
194
195
  language; both need a linked project or `notemend login`. Messages take emoji reactions.
195
196
  - **Keys** — one key per tool, Figma-style: `C` comments, `⇧C` panel, `/` search threads, `R` resolved, `A` archived, `M` spaces,
@@ -243,6 +244,11 @@ For Astro and Next.js projects the same bar runs under `astro dev` / `next dev`,
243
244
  `npx notemend link <project-id>` first — signed out or unlinked, the bar stays away and
244
245
  the dev server's terminal says which to run. Nothing of it reaches a build.
245
246
 
247
+ **On a network you share.** The bar's endpoints (`/__devbar/*`) answer whoever reaches the dev
248
+ server's port, as you: they read the project's threads and can write one. `astro dev` listens
249
+ on this computer only; `next dev` listens on every interface, so on a network that is not
250
+ yours run `next dev -H localhost`, and keep `astro dev --host` for networks you trust.
251
+
246
252
  ### Install
247
253
 
248
254
  ```sh
@@ -322,7 +328,7 @@ export const breakpoints = [
322
328
  { id: 'portrait', label: 'Mobile portrait', min: 0, max: 479, ideal: 390 },
323
329
  ];
324
330
 
325
- // route → [name, group]. Unlisted pages still appear, named by <title>.
331
+ // route → [name, group]. Unlisted pages still appear, named by <title>; `null` leaves a page out.
326
332
  // A number in front of a name only orders the rows: '1.2. About' reads as 'About'.
327
333
  export const pages = {
328
334
  '/': ['Home', 'Main'],
@@ -340,7 +346,7 @@ export const zIndex = 2000000020; // the bar's base layer
340
346
  | Key | Default | |
341
347
  |---|---|---|
342
348
  | `breakpoints` | the four above | `id`, `label`, `min`, `max` (`Infinity` for the widest), `ideal` (canvas width), optional `icon` (SVG paths, 20×20) |
343
- | `pages` | from `src/pages` / `app/` | route → `[name, group]` |
349
+ | `pages` | from `src/pages` / `app/` | route → `[name, group]`, or `null` to leave a page out of the menu |
344
350
  | `groups` | by folder | group order |
345
351
  | `grid` | `container` / `grid` / 12 | classes of your own layout the overlay reuses |
346
352
  | `devices` | the eight above | the preview shelf: `{ id, label, group, w, h, shell, browser, note? }` — `shell`: `island` `home` `punch` `tablet` `macbook` `laptop` `monitor`; `browser`: `safari-ios` `chrome-android` `safari-ipad` `safari-mac` `chrome-windows`; `note` is the row's tooltip. An older (mitka) config gave a device a `frame` picture; such an entry is skipped with a warning |
package/bin/notemend.mjs CHANGED
@@ -53,7 +53,7 @@ const nextConfig: NextConfig = {
53
53
  };
54
54
 
55
55
  export default nextConfig;
56
- `]])await qe(Me(l(w,t)),{recursive:!0}),await D(l(w,t),$);const{wireNext:At}=await import("./init.mjs"),_t=Ot(w,"next");e.deepEqual(_t.pages.map(t=>[t.route,t.name]),[["/","Home"],["/about","About us"]],"a route group is not in the address; private folders, slots and intercepts are no pages"),e.deepEqual(_t.dynamic.map(t=>t.route),["/docs/[slug]"]),e.equal(At(w).written.length,3,"loader, route and config on a fresh project"),e.match(T(l(w,"next.config.ts"),"utf8"),/const nextConfig: NextConfig = \{\n transpilePackages: \['notemend'\],/),e.match(T(l(w,"app/%5F%5Fdevbar/[...path]/route.ts"),"utf8"),/from 'notemend\/next'/),e.match(T(l(w,"instrumentation-client.ts"),"utf8"),/NODE_ENV === 'development'\) import\('notemend\/client'\)/),e.deepEqual(At(w).written,[],"a second run leaves it alone");const{notemendHandler:vo,scanApp:qo}=await import("../src/server/middleware.mjs"),Je=vo({root:w,options:{},routes:()=>qo(w)}),f=(t,$,S,de={})=>Je({method:t,url:$,headers:{host:"localhost:3000",...de},body:async()=>Buffer.from(S?JSON.stringify(S):"")}),$o=JSON.parse((await f("GET","/__devbar/config")).body);e.deepEqual($o.pages.map(t=>t.route),["/","/about"],"the menu lists what app/ serves"),e.equal((await f("POST","/__devbar/comments",{text:"x"},{origin:"http://evil.test"})).status,403,"foreign writes refused"),e.equal((await f("GET","/__devbar/config",null,{host:"evil.com:3000"})).status,403,"a rebound name is refused"),e.equal((await f("GET","/__devbar/config",null,{host:"evil.com:80:80"})).status,403,"so is a malformed host"),e.equal((await f("GET","/__devbar/comments",null,{"sec-fetch-site":"none"})).status,403,"not a typed address"),e.equal((await f("GET","/__devbar/comments",null,{"sec-fetch-site":"same-site"})).status,403,"nor another port's page"),e.equal((await f("GET","/__devbar/comments",null,{"sec-fetch-site":"same-origin"})).status,200,"the bar on its own page, yes"),e.equal((await f("GET","/__devbar/config",null,{host:"[::1]:3000"})).status,200,"IPv6 loopback is local"),e.equal((await Je({method:"POST",url:"/__devbar/comments",headers:{host:"localhost:3000",origin:"http://localhost:3000"},body:async()=>Buffer.from("{not json")})).status,400,"a broken body is a 400");const{mentionsIn:ge}=await import("../src/store/thread.mjs"),he=[{email:"ann@x.co",name:"Ann Lee"},{email:"anna@x.co",name:"Anna",nickname:"anna_k"},{email:"vad@x.co",name:"Vad"}];e.deepEqual(ge("@Ann Lee and @vad, look",he),["ann@x.co","vad@x.co"],"names and case"),e.deepEqual(ge("@anna_k please",he),["anna@x.co"],"nicknames"),e.deepEqual(ge("@Annabel",he),[],"only a whole name"),e.deepEqual(ge("@Vadim and @vad",he),["vad@x.co"],"a longer name first does not hide the shorter one"),e.deepEqual(ge("mail vad@x.co",he),[],"an address without @ in front is not a mention"),e.deepEqual(ge("thanks @Vad.",he),["vad@x.co"],"a full stop after the handle still mentions");const{HANDLE_END:So,duplicatedFrom:Ct,duplicatedTo:Eo}=await import("../src/store/thread.mjs");e.equal(Ct({id:2,from:{id:1}},{id:1,shared:!0},"Sarah"),"Duplicated from Sarah\u2019s client thread","a copy names the original's writer and space"),e.equal(Ct({id:2,shared:!0,from:{id:1}},{id:1,shared:!0}),"Duplicated from a client thread","a copy moved into the original\u2019s space still says where it came from"),e.equal(Eo({id:2}),"Duplicated to the workspace","the original says where its copy is now");const Be=Date.parse("2026-10-28T10:00:00Z"),To=Be+6e4,Oo=xe({text:"x",createdAt:new Date(Be-6e4).toISOString(),images:[`feedback/images/7-${Be+5e3}042.brief.zip`],replies:[{author:"you",text:"R1",at:new Date(Be).toISOString()},{author:"you",text:"R2",at:new Date(To).toISOString()}]});e.equal(Oo.find(t=>t.images.length)?.text,"R1","a big file (three digits after its stamp) stays under its own reply"),e.deepEqual("over to @Claude. and @Claudes".match(new RegExp(`@Claude${So}`,"giu")),["@Claude"],"what the bar and the cabinet light up");const{addClaudeHooks:at}=await import("./init.mjs");await qe(l(w,".claude"),{recursive:!0}),await D(l(w,".claude/settings.json"),JSON.stringify({hooks:{SessionStart:[{hooks:[{type:"command",command:"[ -f x/notemend.mjs ] && node x/notemend.mjs digest"}]}]}})),at(w);const st=JSON.parse(T(l(w,".claude/settings.json"),"utf8")).hooks;e.match(st.SessionStart[0].hooks[0].command,/^if \[ -f .*; fi$/,"an old && hook is upgraded to if/fi"),e.equal(st.UserPromptSubmit.length,1),e.match(st.PostToolUse[0].hooks[0].command,/bin\/step\.mjs" --root "\$CLAUDE_PROJECT_DIR"; fi$/,"Claude's steps: the PostToolUse hook"),e.equal(at(w),0,"the hooks go in once");const No=["../plugin/hooks/hooks.json","../hooks/hooks.json"].map(t=>new URL(t,import.meta.url)).find(t=>U(t));e.ok(JSON.parse(T(No,"utf8")).hooks.PostToolUse[0].hooks[0].command.includes("bin/step.mjs"),"and in the plugin");const{addAgentHooks:jt,addAgentsMd:Pt}=await import("./init.mjs");for(const t of["codex","gemini","cursor"])e.equal(jt(w,t),1,`${t} hooks written`);e.equal(jt(w,"codex"),0,"and only once"),e.ok(JSON.parse(T(l(w,".gemini/settings.json"),"utf8")).hooks.BeforeAgent[0].hooks[0].command.includes("--format gemini")),e.equal(JSON.parse(T(l(w,".cursor/hooks.json"),"utf8")).version,1),e.match(T(l(w,".codex/config.toml"),"utf8"),/codex_hooks = true/),await D(l(w,"AGENTS.md"),`# Project
56
+ `]])await qe(Me(l(w,t)),{recursive:!0}),await D(l(w,t),$);const{wireNext:At}=await import("./init.mjs"),_t=Ot(w,"next");e.deepEqual(_t.pages.map(t=>[t.route,t.name]),[["/","Home"],["/about","About us"]],"a route group is not in the address; private folders, slots and intercepts are no pages"),e.deepEqual(_t.dynamic.map(t=>t.route),["/docs/[slug]"]),e.equal(At(w).written.length,3,"loader, route and config on a fresh project"),e.match(T(l(w,"next.config.ts"),"utf8"),/const nextConfig: NextConfig = \{\n transpilePackages: \['notemend'\],/),e.match(T(l(w,"app/%5F%5Fdevbar/[...path]/route.ts"),"utf8"),/from 'notemend\/next'/),e.match(T(l(w,"instrumentation-client.ts"),"utf8"),/NODE_ENV === 'development'\) import\('notemend\/client'\)/),e.deepEqual(At(w).written,[],"a second run leaves it alone");const{notemendHandler:vo,scanApp:qo}=await import("../src/server/middleware.mjs"),Je=vo({root:w,options:{},routes:()=>qo(w)}),f=(t,$,S,de={})=>Je({method:t,url:$,headers:{host:"localhost:3000",...de},body:async()=>Buffer.from(S?JSON.stringify(S):"")}),$o=JSON.parse((await f("GET","/__devbar/config")).body);e.deepEqual($o.pages.map(t=>t.route),["/","/about"],"the menu lists what app/ serves"),e.equal((await f("POST","/__devbar/comments",{text:"x"},{origin:"http://evil.test"})).status,403,"foreign writes refused"),e.equal((await f("GET","/__devbar/config",null,{host:"evil.com:3000"})).status,403,"a rebound name is refused"),e.equal((await f("GET","/__devbar/config",null,{host:"evil.com:80:80"})).status,403,"so is a malformed host"),e.equal((await f("GET","/__devbar/comments",null,{"sec-fetch-site":"none"})).status,403,"not a typed address"),e.equal((await f("GET","/__devbar/comments",null,{"sec-fetch-site":"same-site"})).status,403,"nor another port's page"),e.equal((await f("GET","/__devbar/comments",null,{"sec-fetch-site":"same-origin"})).status,200,"the bar on its own page, yes"),e.equal((await f("GET","/__devbar/config",null,{host:"[::1]:3000"})).status,200,"IPv6 loopback is local"),e.equal((await Je({method:"POST",url:"/__devbar/comments",headers:{host:"localhost:3000",origin:"http://localhost:3000"},body:async()=>Buffer.from("{not json")})).status,400,"a broken body is a 400");const{mentionsIn:ge}=await import("../src/store/thread.mjs"),he=[{email:"ann@x.co",name:"Ann Lee"},{email:"anna@x.co",name:"Anna",nickname:"anna_k"},{email:"vad@x.co",name:"Vad"}];e.deepEqual(ge("@Ann Lee and @vad, look",he),["ann@x.co","vad@x.co"],"names and case"),e.deepEqual(ge("@anna_k please",he),["anna@x.co"],"nicknames"),e.deepEqual(ge("@Annabel",he),[],"only a whole name"),e.deepEqual(ge("@Vadim and @vad",he),["vad@x.co"],"a longer name first does not hide the shorter one"),e.deepEqual(ge("mail vad@x.co",he),[],"an address without @ in front is not a mention"),e.deepEqual(ge("thanks @Vad.",he),["vad@x.co"],"a full stop after the handle still mentions");const{HANDLE_END:So,duplicatedFrom:Ct,duplicatedTo:Eo}=await import("../src/store/thread.mjs");e.equal(Ct({id:2,from:{id:1}},{id:1,shared:!0},"Sarah"),"Duplicated from Sarah\u2019s client thread","a copy names the original's writer and space"),e.equal(Ct({id:2,shared:!0,from:{id:1}},{id:1,shared:!0}),"Duplicated from a client thread","a copy moved into the original\u2019s space still says where it came from"),e.equal(Eo({id:2}),"Mirrored to Team","the original says where its copy is now");const Be=Date.parse("2026-10-28T10:00:00Z"),To=Be+6e4,Oo=xe({text:"x",createdAt:new Date(Be-6e4).toISOString(),images:[`feedback/images/7-${Be+5e3}042.brief.zip`],replies:[{author:"you",text:"R1",at:new Date(Be).toISOString()},{author:"you",text:"R2",at:new Date(To).toISOString()}]});e.equal(Oo.find(t=>t.images.length)?.text,"R1","a big file (three digits after its stamp) stays under its own reply"),e.deepEqual("over to @Claude. and @Claudes".match(new RegExp(`@Claude${So}`,"giu")),["@Claude"],"what the bar and the cabinet light up");const{addClaudeHooks:at}=await import("./init.mjs");await qe(l(w,".claude"),{recursive:!0}),await D(l(w,".claude/settings.json"),JSON.stringify({hooks:{SessionStart:[{hooks:[{type:"command",command:"[ -f x/notemend.mjs ] && node x/notemend.mjs digest"}]}]}})),at(w);const st=JSON.parse(T(l(w,".claude/settings.json"),"utf8")).hooks;e.match(st.SessionStart[0].hooks[0].command,/^if \[ -f .*; fi$/,"an old && hook is upgraded to if/fi"),e.equal(st.UserPromptSubmit.length,1),e.match(st.PostToolUse[0].hooks[0].command,/bin\/step\.mjs" --root "\$CLAUDE_PROJECT_DIR"; fi$/,"Claude's steps: the PostToolUse hook"),e.equal(at(w),0,"the hooks go in once");const No=["../plugin/hooks/hooks.json","../hooks/hooks.json"].map(t=>new URL(t,import.meta.url)).find(t=>U(t));e.ok(JSON.parse(T(No,"utf8")).hooks.PostToolUse[0].hooks[0].command.includes("bin/step.mjs"),"and in the plugin");const{addAgentHooks:jt,addAgentsMd:Pt}=await import("./init.mjs");for(const t of["codex","gemini","cursor"])e.equal(jt(w,t),1,`${t} hooks written`);e.equal(jt(w,"codex"),0,"and only once"),e.ok(JSON.parse(T(l(w,".gemini/settings.json"),"utf8")).hooks.BeforeAgent[0].hooks[0].command.includes("--format gemini")),e.equal(JSON.parse(T(l(w,".cursor/hooks.json"),"utf8")).version,1),e.match(T(l(w,".codex/config.toml"),"utf8"),/codex_hooks = true/),await D(l(w,"AGENTS.md"),`# Project
57
57
  `),e.equal(Pt(w),1),e.equal(Pt(w),0,"the block goes in once"),e.match(T(l(w,"AGENTS.md"),"utf8"),/^# Project\n\n<!-- notemend -->/),await D(l(w,".claude/settings.json"),"{ broken");{const t=console.warn;console.warn=()=>{};try{e.equal(at(w),0,"a broken settings.json is left alone")}finally{console.warn=t}}const Dt=await f("POST","/__devbar/comments",{text:"hi",route:"/about"},{origin:"http://localhost:3000"});e.equal(Dt.status,201),e.equal(JSON.parse((await f("GET","/__devbar/comments?route=/about")).body).comments[0].text,"hi");const Ao=JSON.parse((await f("GET","/__devbar/comments")).body).version;e.equal((await f("GET",`/__devbar/comments?since=${Ao}`)).status,204,"a local store with nothing new answers an empty 204");const Q=JSON.parse(Dt.body).id;await f("PATCH","/__devbar/comments",{id:Q,status:"done",doneBy:"you"},{origin:"http://localhost:3000"});const It=JSON.parse((await f("GET","/__devbar/comments?open=1&route=/about")).body);e.ok(!It.comments.some(t=>t.id===Q),"?open=1 leaves a signed-off thread out"),e.equal(typeof It.version,"string","the version comes with the read"),await f("PATCH","/__devbar/comments",{id:Q,status:"open",doneBy:null},{origin:"http://localhost:3000"}),e.ok(JSON.parse((await f("GET","/__devbar/comments?open=1&route=/about")).body).comments.some(t=>t.id===Q),"reopened, it is back");{const t=JSON.parse((await f("GET","/__devbar/comments")).body).comments.find(S=>S.id===Q).updatedAt;await new Promise(S=>setTimeout(S,5));const $=JSON.parse((await f("PATCH","/__devbar/comments",{id:Q,note:"x",due:"y"},{origin:"http://localhost:3000"})).body);e.equal($.updatedAt,t,"an empty change does not touch updatedAt")}{const t=JSON.parse((await f("POST","/__devbar/comments",{text:"lost",route:"/about",selector:"main>div",fp:{head:"Agency",aria:"x".repeat(500),bad:1},spot:{x:10.4,y:-5},opener:{selector:"button",label:"Account",evil:1}},{origin:"http://localhost:3000"})).body);e.deepEqual(t.fp,{aria:"x".repeat(120),head:"Agency"},"a fingerprint keeps its own fields, cut short"),e.deepEqual(t.spot,{x:10,y:0},"the spot is whole page pixels, never off the page"),e.equal(t.opener.label,"Account"),e.equal(t.opener.evil,void 0,"an opener keeps an anchor's fields only");const $=t.updatedAt;await new Promise(Wo=>setTimeout(Wo,5));const S=JSON.parse((await f("PATCH","/__devbar/comments",{id:t.id,anchor:"gone"},{origin:"http://localhost:3000"})).body);e.equal(S.anchor,"gone"),e.equal(S.updatedAt,$,"the bar seeing it gone is no news: updatedAt stays");const de=JSON.parse((await f("PATCH","/__devbar/comments",{id:t.id,anchor:null,repin:"div.card \xABAgency\xBB",move:{selector:"main>p",rx:.5,ry:.5,label:"Studio",fp:{head:"Studio"}}},{origin:"http://localhost:3000"})).body);e.equal(de.selector,"main>p"),e.equal(de.repinnedFrom,"div.card \xABAgency\xBB"),e.ok(de.repinnedAt),e.deepEqual(de.fp,{head:"Studio"}),e.equal(de.anchor,null,"re-pinned, it is found again");const Qt=JSON.parse((await f("PATCH","/__devbar/comments",{id:t.id,repin:!1,move:{selector:"main>div",rx:.5,ry:.5,label:""}},{origin:"http://localhost:3000"})).body);e.equal(Qt.repinnedAt,null,"its Undo takes the line away"),e.equal(Qt.selector,"main>div"),e.equal(JSON.parse((await f("PATCH","/__devbar/comments",{id:t.id,anchor:"lost?"},{origin:"http://localhost:3000"})).body).anchor,null,"only the three words")}const ee=z(w);e.equal(ee.versionOf(ee.load()),ee.version(),"a copy knows the version it was read at");const Jt=await f("GET","/__devbar/events");e.equal(Jt.type,"text/event-stream");const Le=[],_o=Jt.stream(t=>Le.push(t));await new Promise(t=>setTimeout(t,100)),await f("PATCH","/__devbar/comments",{id:Q,category:"copy"},{origin:"http://localhost:3000"}),await new Promise(t=>setTimeout(t,100)),e.equal(Le.at(-1),ee.version(),"the bar's own write is announced at once");{const t=ee.load();C(t,Q,{category:"general"}),ee.save(t)}for(let t=0;t<30&&Le.at(-1)!==ee.version();t++)await new Promise($=>setTimeout($,100));e.equal(Le.at(-1),ee.version(),"a write from outside (the CLI, an agent) is announced too"),_o(),e.equal((await Je({method:"GET",url:"/__devbar/events",headers:{host:"evil.com:3000"},body:async()=>Buffer.from("")})).status,403,"the line answers local addresses only");const{mask:$e}=await import("../src/store/mask.mjs");e.equal($e("GET https://api.x.co/v1/me?access_token=abc123&page=2 \u2192 401"),"GET https://api.x.co/v1/me?access_token=\u2022\u2022\u2022&page=2 \u2192 401","a token in an address"),e.equal($e("Authorization: Bearer sk_live_9f8e7d"),"Authorization: Bearer \u2022\u2022\u2022","a Bearer credential"),e.equal($e("https://ann:hunter2@db.x.co/"),"https://\u2022\u2022\u2022@db.x.co/","user:password@"),e.equal($e("jwt eyJhbGciOi.eyJzdWIiOi.SflKxwRJ end"),"jwt \u2022\u2022\u2022 end","a JWT"),e.equal($e("POST /api/signup \u2192 500"),"POST /api/signup \u2192 500","a plain line stays as it is");const Bt=await f("POST","/__devbar/comments",{text:"form does nothing",route:"/about",logs:[{at:"2026-10-08T00:00:00Z",kind:"network",text:"POST /api/signup?key=s3cret \u2192 500"},{at:"2026-10-08T00:00:01Z",kind:"weird",text:"TypeError: x is undefined"},{at:"2026-10-08T00:00:02Z",kind:"console",text:""}]},{origin:"http://localhost:3000"}),Lt=JSON.parse(Bt.body).logs;e.deepEqual(Lt.map(t=>t.kind),["network","console"],"kinds are known ones, empty lines dropped"),e.equal(Lt[0].text,"POST /api/signup?key=\u2022\u2022\u2022 \u2192 500","the server masks what the browser sent"),e.ok(!("logs"in JSON.parse((await f("GET","/__devbar/comments?route=/about")).body).comments.find(t=>t.id===JSON.parse(Bt.body).id)),"a bar is never sent the logs");const Co=await f("POST","/__devbar/comments",{text:"no trouble",route:"/about",logs:[]},{origin:"http://localhost:3000"}),jo=await f("POST","/__devbar/comments",{text:"on staging",route:"/about",host:"Staging.Example.com:8443"},{origin:"http://localhost:3000"});e.equal(JSON.parse(jo.body).host,"staging.example.com:8443","the host is kept, lower-cased");const Po=await f("POST","/__devbar/comments",{text:"odd",route:"/about",host:"evil.com/<script>"},{origin:"http://localhost:3000"});e.equal(JSON.parse(Po.body).host,void 0,"anything that is not a host is dropped");const Rt="data:image/webp;base64,UklGRg==",Ft=JSON.parse((await f("POST","/__devbar/comments",{text:"framed",route:"/about",before:Rt},{origin:"http://localhost:3000"})).body);e.match(Ft.images?.[0]??"",/\/before-\d+-\d+\.webp$/,"the before frame is filed with the comment");const Gt=async()=>JSON.parse((await Je({method:"PATCH",url:"/__devbar/comments",headers:{host:"localhost:3000",origin:"http://localhost:3000"},body:async()=>Buffer.from(JSON.stringify({id:Ft.id,status:"done",doneBy:"you",after:Rt}))})).body);await Gt();const Ht=await Gt();e.equal(Ht.images.filter(t=>/\/after-/.test(t)).length,1,"a second after replaces the first"),e.deepEqual(xe(Ht).flatMap(t=>t.images),[],"frames are not under any message"),e.equal(JSON.parse(Co.body).logs,void 0,"no logs, no field"),await Oe(w,{recursive:!0,force:!0});const{buildConfig:Mt}=await import("../src/server/middleware.mjs");e.equal(Mt({root:y,options:{},routes:[]}).shortcuts,!0,"keys are on by default"),e.equal(Mt({root:y,options:{shortcuts:!1},routes:[]}).shortcuts,!1,"and can be switched off");const{DEVICES:Do,SHELLS:Io,BROWSERS:Jo}=await import("../src/presets.mjs");e.ok(Do.every(t=>t.w>0&&t.h>0&&Io.includes(t.shell)&&Jo.includes(t.browser)),"every preview device has a size, a body and a browser");const{DEVTOOLS_DEVICES:Re,DEVTOOLS_GROUPS:Bo}=await import("../src/devtools-devices.mjs");e.ok(Re.length>30,"the DevTools list is there"),e.equal(new Set(Re.map(t=>t.id)).size,Re.length,"device ids are unique"),e.ok(Re.every(t=>t.w>0&&t.h>0&&Bo.includes(t.group)),"every device has a size and a group");const te=await fe(l(we(),"notemend-mcp-")),Ut={comments:[]};J(Ut,{route:"/",selector:"h1",rx:0,ry:0,text:"make the title bigger",assignee:"claude"}),z(te).save(Ut);const{spawn:Lo}=await import("node:child_process"),Fe=Lo(process.execPath,[new URL(import.meta.url).pathname,"mcp","--root",te],{stdio:["pipe","pipe","inherit"]}),A=new Map;let Se="";Fe.stdout.on("data",t=>{Se+=t;for(let $;($=Se.indexOf(`
58
58
  `))>=0;Se=Se.slice($+1)){const S=JSON.parse(Se.slice(0,$));A.set(S.id,S)}});const Ee={_meta:{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{name:"Cursor",version:"3"}}},se=(t,$,S)=>Fe.stdin.write(JSON.stringify({jsonrpc:"2.0",id:t,method:$,params:S})+`
59
59
  `);se(1,"server/discover",Ee),se(2,"initialize",{protocolVersion:"2025-06-18",capabilities:{},clientInfo:{name:"x",version:"1"}}),se(3,"tools/list",Ee),se(4,"tools/call",{...Ee,name:"list_comments",arguments:{}}),se(5,"tools/call",{...Ee,name:"reply",arguments:{id:1,text:"on it"}}),se(6,"tools/call",{...Ee,name:"reply",arguments:{id:1,text:"--root"}}),se(7,"tools/list",{_meta:{"io.modelcontextprotocol/protocolVersion":"1900-01-01"}}),Fe.stdin.end(),await new Promise(t=>Fe.on("close",t)),e.ok(A.get(1).result.supportedVersions.includes("2026-07-28"),"discover names the modern revision"),e.equal(A.get(1).result.resultType,"complete","modern results say they are complete"),e.equal(A.get(2).result.protocolVersion,"2025-06-18","a legacy client keeps its version"),e.equal(A.get(2).result.resultType,void 0,"and gets the legacy shape");for(const t of[1,3])e.ok(A.get(t).result.ttlMs>=0&&["public","private"].includes(A.get(t).result.cacheScope),"discover and tools/list carry the caching hints modern clients require");e.equal(A.get(2).result.ttlMs,void 0,"legacy results stay as they were"),e.deepEqual(A.get(3).result.tools.map(t=>t.name),["list_comments","start","reply","resolve","reopen","screenshot"]),e.ok(!A.get(3).result.tools.some(t=>t.args),"argv builders stay private"),e.match(A.get(4).result.content[0].text,/make the title bigger/,"list runs the CLI on the store"),e.equal(A.get(5).result.isError,!1),e.equal(A.get(6).result.isError,!0,"a text that would read as a flag is refused"),e.equal(A.get(7).error.code,-32022,"an unknown version is named as such");const Vt=z(te).load().comments[0].replies;e.equal(Vt.length,1,"only the good reply landed"),e.equal(Vt[0].agent,"cursor","the reply is signed by the client that sent it");const{spawnSync:Ro}=await import("node:child_process"),H=(...t)=>Ro(process.execPath,[new URL(import.meta.url).pathname,...t,"--root",te],{encoding:"utf8"});e.equal(H("start","1","--as","codex").status,0,"an agent takes a thread"),e.equal(z(te).load().comments[0].working.agent,"codex","and the thread says so");const Zt=H("start","1","--as","cursor");e.equal(Zt.status,1,"another agent is refused"),e.match(Zt.stderr,/via Codex since/,"and told who is on it"),e.equal(H("start","1","--as","codex").status,0,"the same agent may take it again"),e.match(H("list").stdout,/taken: Agent via Codex/,"the list shows who is on it"),e.equal(H("start","1","--as","cursor","--force").status,0,"--force takes it anyway"),e.equal(H("done","1","fixed","--as","cursor").status,0),e.equal(z(te).load().comments[0].working,null,"done clears the mark"),e.equal(H("start","1").status,1,"a resolved thread is not taken"),e.equal(H("reopen","1").status,0);const Wt=z(te).load().comments[0];e.ok(Wt.reopenedAt&&Wt.stage==="approved","reopened from the CLI as from the bar: stamped, back in the queue"),e.equal(H("start","1","--as","codex").status,0),e.equal(H("start","1","--as","--force").status,0,"a flag with no value does not eat the next one");const{workingOn:Fo}=await import("../src/store/thread.mjs");e.equal(Fo({status:"open",working:{agent:"codex",at:new Date(Date.now()-3*36e5).toISOString()}}),null,"a mark hours old counts as left behind");const{agentStep:I,stageOf:Go}=await import("../src/store/thread.mjs"),it={agent:"claude",at:new Date().toISOString()},Ho={agent:"claude",at:new Date(Date.now()-3*36e5).toISOString()},_={text:"x",status:"open",assignee:"agent:a@b.co",stage:"approved"};e.equal(I({..._}),"queued","approved, not taken: in the queue"),e.equal(I({..._,working:it}),"working","taken: working"),e.equal(I({..._,working:it,replies:[{author:"claude",text:"which?"}]}),"asks","its question waits for a person, mark or not"),e.equal(I({..._,working:it,replies:[{author:"claude",text:"Found the header, fixing the padding now."}]}),"working","a note on progress while on it: still working, not asking"),e.equal(I({..._,replies:[{author:"claude",text:"Found the header."}]}),"asks","its last word with nobody on it waits for a person"),e.equal(I({..._,replies:[{author:"claude",text:"done",at:"2026-01-01T10:00:00Z"}],reopenedAt:"2026-01-01T11:00:00Z"}),"queued","sent back after its last word: back in the queue, not asking"),e.equal(I({..._,working:Ho}),"stuck","a stale mark: stuck");const{stepWords:Ge,elapsed:rt,liveStep:zt,QUIET:Mo}=await import("../src/store/thread.mjs");e.equal(Ge("Editing PricingComparisonTableRow.astro"),"Editing PricingCompar\u2026Row.astro","a long name keeps its extension"),e.equal(Ge("Editing Hero.astro"),"Editing Hero.astro","a short one stays whole"),e.equal(Ge("Running a command that goes on and on and on"),"Running a command that goes on\u2026","no extension: cut at the end"),e.equal(Ge("Editing "+"\u{1F469}\u200D\u{1F469}\u200D\u{1F467}".repeat(30)+".tsx"),"Editing "+"\u{1F469}\u200D\u{1F469}\u200D\u{1F467}".repeat(15)+"\u2026"+"\u{1F469}\u200D\u{1F469}\u200D\u{1F467}".repeat(3)+".tsx","never half an emoji");const W=Date.parse("2026-10-30T10:00:00Z");e.equal(rt("2026-10-30T09:59:30Z",W),"now"),e.equal(rt("2026-10-30T09:56:00Z",W),"4 min"),e.equal(rt("2026-10-30T07:50:00Z",W),"2 h");const lt={agent:"claude",since:"2026-10-30T09:54:00Z",at:"2026-10-30T09:59:00Z",step:"Editing Hero.astro"};e.deepEqual(zt({..._,working:lt},W),{step:"Editing Hero.astro",elapsed:"6 min",silent:"1 min",stale:!1},"the step, since taken"),e.equal(I({..._,working:lt},W),"working");const ct={...lt,at:new Date(W-Mo-2*6e4).toISOString(),step:"Running npm"};e.equal(I({..._,working:ct},W),"stuck","no step for a while: went quiet"),e.equal(zt({..._,working:ct},W).silent,"12 min","silent for 12 min"),e.equal(I({..._,working:{...ct,step:void 0}},W),"working","no hook, no steps: a long fix is not quiet"),e.equal(I({..._,status:"done",doneBy:"claude"}),"review","the agent says done: a person checks"),e.equal(I({..._,status:"done",doneBy:"you"}),"done","a person agreed: done"),e.equal(Go({text:"x",status:"open",assignee:"claude",stage:"accepted"}),"review","a leftover accepted reads as to check"),e.equal(O({text:"x",status:"open",assignee:"claude",stage:"accepted"}),!1,"a leftover accepted is not queued for the agent"),e.equal(O({text:"x",status:"open",assignee:"claude",stage:"approved",shared:!0}),!1,"a client's thread is never the agent's"),e.equal(O({text:"x",status:"open",assignee:"claude",stage:"approved"}),!0,"a studio thread given to the agent is"),e.equal(I({text:"x",status:"open",assignee:"ann@b.co"}),null,"a person's thread has no agent step");const{pinWho:oe}=await import("../src/store/thread.mjs"),ie={text:"x",status:"open",by:"Sarah@a.co"};e.deepEqual(oe(ie,"open"),{writer:"sarah@a.co",taker:"",claude:!1},"nobody has it yet"),e.deepEqual(oe({...ie,assignee:"mark@a.co"},"open"),{writer:"sarah@a.co",taker:"mark@a.co",claude:!1},"Mark took it"),e.equal(oe({...ie,assignee:"claude",stage:"approved",handedBy:"mark@a.co"},"open").taker,"mark@a.co","queued: whoever handed it over"),e.equal(oe({...ie,assignee:"claude",handedBy:"mark@a.co",working:{agent:"claude",by:"ann@a.co",at:new Date().toISOString()}},"open").taker,"ann@a.co","working: whoever runs it"),e.equal(oe({...ie,status:"done",doneBy:"claude",doneFor:"mark@a.co",assignee:"claude"},"claude").taker,"mark@a.co","fixed: whoever it fixed it for"),e.equal(oe({...ie,assignee:"claude"},"open").taker,"sarah@a.co","nobody known: the writer's Claude"),e.equal(oe({text:"x",status:"open"},"open"),null,"no writer known: the bare dot"),e.equal(oe(ie,"done"),null,"resolved: the tick");const{linkLabel:re,linkParts:Kt}=await import("../src/store/thread.mjs"),{cut:dt}=await import("../src/store/thread.mjs");e.equal(dt("ab\u{1F600}",3),"ab","cut never keeps half an emoji"),e.equal(dt("a\u{1F469}\u200D\u{1F469}\u200D\u{1F467}b",6),"a","cut never splits a family at its joiner"),e.equal(dt("short",60),"short","a short text stays whole"),e.equal(re("https://www.figma.com/design/k7k5AbC/Notemend?node-id=96-309604").label,"Figma \xB7 Notemend","Figma: the file"),e.equal(re("https://www.figma.com/design/k7k5AbC/Notemend-website").label,"Figma \xB7 Notemend website","Figma: dashes are spaces"),e.deepEqual(re("https://github.com/acme/notemend/pull/42"),{label:"GitHub \xB7 notemend #42",kind:"pr"},"GitHub: a pull request"),e.equal(re("https://github.com/acme/notemend").label,"GitHub \xB7 notemend","GitHub: a repo"),e.equal(re("https://www.loom.com/share/abc123").label,"Loom","Loom"),e.equal(re("https://acme.com/blog/launch-week/").label,"acme.com \xB7 launch-week","any address: host and its last part"),e.equal(re("https://acme.com").label,"acme.com","a bare host"),e.deepEqual(Kt("The gap is 24 in https://figma.com/design/k/Notemend. Here 40.").map(t=>typeof t=="string"?t:t.url),["The gap is 24 in ","https://figma.com/design/k/Notemend",". Here 40."],"the full stop stays with the words"),e.deepEqual(Kt("no links"),["no links"],"no links: the text as it is");const{linkWords:Uo}=await import("../src/store/thread.mjs");e.equal(Uo("See https://github.com/acme/notemend/pull/42."),"See GitHub \xB7 notemend #42.","a preview names its links");const{agentMentioned:le}=await import("../src/store/thread.mjs"),M=[{email:"ann@b.co",name:"Ann Lee"},{email:"bo@b.co",name:"Bo",agent_name:"Robo"}];e.equal(le("please @agent look",M),"claude","one agent: @agent"),e.equal(le("please @Claude. look",M),"claude","the old names still hand it over: @Claude."),e.equal(le("@Codex and @gemini",M),"claude","and @codex, @gemini");const{mentionKind:ut}=await import("../src/store/thread.mjs");e.equal(ut("@Claude",M,"ann@b.co"),"agent","an old agent name is lit as the agent"),e.equal(ut("Ann Lee",M,"ann@b.co"),"you","your own name is yours"),e.equal(ut("bo",M,"ann@b.co"),"person","someone else is a person"),e.equal(le("@claude, then @Ann Lee",M),"claude","any case, anywhere in the text"),e.equal(le("@Claudette",M),null,"a whole handle only"),e.equal(le("@agents",M),null,"a whole handle only: @agents is not @agent"),e.equal(le("@Ann Lee have a look",M),null,"a person is not an agent"),await Oe(te,{recursive:!0,force:!0}),await Oe(y,{recursive:!0,force:!0}),await Oe(a,{recursive:!0,force:!0});const He={assignee:"agent:ann@x.co"},Yt={assignee:"claude"},Vo={assignee:"bob@x.co"};e.ok(O(Yt,"bob@x.co")&&O(Yt,null),"any agent, CI included, takes the shared queue"),e.ok(!O({},"bob@x.co")&&!O({},void 0),"a comment given to nobody waits for an approval"),e.ok(O(He,"ann@x.co")&&!O(He,"bob@x.co"),"Ann's thread goes to Ann's agent only"),e.ok(!O(He,null)&&O(He,void 0),"a CI key skips it; a local store has one agent for all"),e.ok(!O(Vo,"bob@x.co"),"a thread for a person is not an agent's"),e.ok(!O({assignee:"claude",stage:"new"},null)&&!O({assignee:"claude",stage:"review"},null),"given to an agent, but not approved: it waits");const{clashOf:ce}=await import("../src/store/thread.mjs"),Te={status:"open",stage:"waiting",stageBy:"olena@x.co"};e.deepEqual(ce(Te,{stage:"new",status:"open"},{stage:"progress"},"ann@x.co"),{field:"status",by:"olena@x.co"},"Olena changed the status just now"),e.equal(ce(Te,{stage:"waiting",status:"open"},{stage:"progress"},"ann@x.co"),null,"nothing changed since: it goes"),e.equal(ce(Te,{stage:"new",status:"open"},{stage:"waiting"},"ann@x.co"),null,"the same pick twice is no clash"),e.equal(ce(Te,{stage:"new",status:"open"},{stage:"progress"},"olena@x.co"),null,"my own earlier write is no clash"),e.deepEqual(ce({status:"done",doneBy:"you",confirmedBy:"bob@x.co"},{stage:null,status:"open"},{stage:"progress"},"ann@x.co"),{field:"status",by:"bob@x.co"},"resolved since: a stage set on it is refused too"),e.deepEqual(ce({priority:"high"},{priority:null},{priority:"low"}),{field:"priority",by:null},"a priority has no author: someone"),e.equal(ce(Te,void 0,{stage:"progress"}),null,"no look sent (an older bar, the CLI): as before"),e.ok(O({stage:"approved"},null),"approved for nobody in particular is the shared queue");const{cleanAssignee:Xt,agentLabel:Zo}=await import("../src/store/thread.mjs");e.equal(Xt("agent:Ann@X.co"),"agent:ann@x.co"),e.equal(Xt("agent:nope"),null),e.equal(Zo("claude","ann@x.co",()=>"Ann"),"Agent \xB7 Ann"),e.ok(Ce("0.1.10","0.1.9")&&!Ce("0.1.9","0.1.10")&&!Ce("0.1.10","0.1.10"),"versions compare as numbers");{const{openStore:t}=await import("../src/store/cloud.mjs");delete process.env.NOTEMEND_LOCAL;const $=await fe(l(we(),"notemend-bare-"));await e.rejects(t($),S=>S.status===401&&S.signin&&/npx notemend (login|link)/.test(S.said),"comments need an account"),e.ok(!U(l($,"feedback")),"and nothing is written to the repo"),process.env.NOTEMEND_LOCAL="1"}console.log("notemend selftest ok"),process.exit(0)}if(d==="init"&&N.includes("--ci")){const{addCiWorkflow:e}=await import("./init.mjs");console.log(e(k)?"Wrote .github/workflows/notemend.yml. Add the repository secrets NOTEMEND_KEY (project settings \u2192 Agent on GitHub \u2192 Make a key) and ANTHROPIC_API_KEY, and commit .notemend.json (npx notemend link).":".github/workflows/notemend.yml is already there \u2014 left alone."),process.exit(0)}if(d==="mcp"&&(await(await import("./mcp.mjs")).serve(k,ue&&ft[ue]?ue:null),process.exit(0)),d==="init"){const{init:e}=await import("./init.mjs");await e(k,N),process.exit(0)}if(["login","logout","link","unlink","whoami"].includes(d)){const e=await import("../src/store/cloud.mjs");if(d==="logout"&&(e.logout(),console.log("Signed out on this computer."),process.exit(0)),d==="unlink"&&(e.unlink(k),console.log("Unlinked \u2014 comments go to feedback/ again."),process.exit(0)),d==="whoami"){const s=await e.session().catch(r=>{console.error(`Could not reach Notemend: ${r.message}`),process.exit(1)}),i=e.linkedProject(k);console.log(s?`Signed in as ${s.email}`:"Not signed in (npx notemend login)."),console.log(i?`This site files into project ${i}`:"This site is not linked to a project (npx notemend link)."),process.exit(0)}if(d==="link"){g&&!/^[0-9a-f-]{36}$/.test(g)&&(console.error("link takes a project id from the cabinet, or nothing to make a new project."),process.exit(1));let s=g;if(!s){let r={};try{r=JSON.parse(T(l(k,"package.json"),"utf8"))}catch{}const b=String(r.name||Qo(k)).replace(/^@[^/]+\//,"").replace(/[-_]+/g," ").replace(/^\w/,c=>c.toUpperCase()).slice(0,80),p=/^https?:\/\//.test(r.homepage||"")?r.homepage.replace(/\/$/,""):null;try{const c=await e.createProject(b,p);s=c.id,console.log(`Made project "${c.name}" in your cabinet: ${e.CABINET}/p/${c.id}`)}catch(c){console.error(c.message),process.exit(1)}}if(e.link(k,s),await e.session())try{const r=(await e.cloudStore(k,s).load()).comments.length;console.log(`Linked. ${r} thread${r===1?"":"s"} in the project so far. Commit .notemend.json so the team shares it.`)}catch(r){e.unlink(k),console.error(r.message),process.exit(1)}else console.log("Linked. Now sign in: npx notemend login");process.exit(0)}if(!N.includes("--code")){const{execFile:s}=await import("node:child_process"),i=r=>{console.log(`Opening the cabinet to sign in. If no browser opens \u2014 or the browser is on another computer \u2014 visit:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notemend",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "mcpName": "io.github.zharkodv-cmd/notemend",
5
5
  "description": "A dev-only toolbar for Astro and Next.js sites: pinned page comments Claude Code can read and answer, spacing/size/type inspectors in design px, a layout grid, breakpoint canvas and device preview.",
6
6
  "keywords": [