pi-ext bugabingas pi extensions
owned by bugabinga
README Source History Refs Reviews Compare Notes Search Review guide style(the-system): apply repository formatting
10f616b9395009cd24842d1da1d0a7731eee49f8
Oliver Krylow <o.krylow@isp-insoft.de > · 26 Aug 2026
SSH signature · not checked
Browse files Compare with HEAD
Changed files (5) Diff layout Auto Unified Split
extensions/the-system/__e2e__/mockup.spec.ts Modified +3 / −1 text lines
66 66 await page.getByLabel ("Pin note" ).fill ("tighten spacing" ); await page.getByLabel ("Pin note" ).fill ("tighten spacing" );67 67 const annotationGeometry = await fragment.evaluate ((element) => { const annotationGeometry = await fragment.evaluate ((element) => {68 68 const fragmentRect = element.getBoundingClientRect (); const fragmentRect = element.getBoundingClientRect ();69 - const bubbleRect = element.querySelector (".pin-bubble" )?.getBoundingClientRect ();69 + const bubbleRect = element70 + .querySelector (".pin-bubble" )71 + ?.getBoundingClientRect ();70 72 const pinRect = element.querySelector (".pin" )?.getBoundingClientRect (); const pinRect = element.querySelector (".pin" )?.getBoundingClientRect ();72 74 clientWidth: element.clientWidth, clientWidth: element.clientWidth,extensions/the-system/__tests__/mockup-tool.test.ts Modified +25 / −7 text lines
45 45 const roots: string [] = [];const roots: string [] = [];46 46 afterEach (async () => {afterEach (async () => {47 - await Promise . all ( roots.splice (0 ).map ((root) => rm (root , { recursive: true }))) ; 48 + roots.splice (0 ).map ((root) => rm (root , { recursive: true })), 50 52 async function temporaryRoot (): Promise <string > {async function temporaryRoot (): Promise <string > {121 123 request.options [0 ].html, request.options [0 ].html,123 125 assert.deepStrictEqual ( assert.deepStrictEqual (124 - JSON . parse ( await readFile (path.join (path.dirname (first), "request.json" ), "utf8" )) ,127 + await readFile (path.join (path.dirname (first), "request.json" ), "utf8" ),127 131 assert.deepStrictEqual ( assert.deepStrictEqual (128 - JSON . parse ( await readFile (path.join (path.dirname (first), "feedback.json" ), "utf8" )) ,133 + await readFile (path.join (path.dirname (first), "feedback.json" ), "utf8" ),131 137 const manifest = JSON .parse (await readFile (second, "utf8" )); const manifest = JSON .parse (await readFile (second, "utf8" ));156 162 cacheManifest : "/cache/two/manifest.json" , cacheManifest : "/cache/two/manifest.json" ,159 - assert . ok ( capsule.indexOf ("Current: iteration 2, accept" ) < capsule . indexOf ( " Earlier iterations " ) ) ; 166 + capsule.indexOf ("Current: iteration 2, accept" ) < 167 + capsule.indexOf ("Earlier iterations" ),160 169 assert.match (capsule, /Selected: none/ ); assert.match (capsule, /Selected: none/ );161 170 assert.match (capsule, /never infer rejection from non-selection/ ); assert.match (capsule, /never infer rejection from non-selection/ );162 - assert . match ( capsule , /1 iterate; selected dense \(Dense\); notes: keep density/) ; 173 + /1 iterate; selected dense \(Dense\); notes: keep density/ , 163 175 assert.match (capsule, /annotation dense: tighten/ ); assert.match (capsule, /annotation dense: tighten/ );193 205 }) as unknown as ExtensionContext ; }) as unknown as ExtensionContext ;194 - const runtime = createMockupRuntime ({ cacheRoot : root , openBrowser : false } ) ; 206 + const runtime = createMockupRuntime ({195 210 assert.strictEqual (runtime.contextCapsule (context ("owner" )), capsule); assert.strictEqual (runtime.contextCapsule (context ("owner" )), capsule);196 - assert . strictEqual ( runtime.contextCapsule (context ("new-session" )), undefined ) ; 212 + runtime.contextCapsule (context ("new-session" )),199 217 it ("removes orphaned and expired entries while protecting the current session" , async () => { it ("removes orphaned and expired entries while protecting the current session" , async () => {extensions/the-system/__tests__/mockup.test.ts Modified +1 / −3 text lines
307 307 action : "iterate" , action : "iterate" ,308 308 selected : ["a" ], selected : ["a" ],309 309 notes : "keep A, denser drawer" , notes : "keep A, denser drawer" ,311 - { optionId: "a" , x: 0.25 , y: 0.5 , note: "tighten" },310 + annotations : [ { optionId: "a" , x: 0.25 , y: 0.5 , note: "tighten" }] ,313 311 userAgent : client.userAgent , userAgent : client.userAgent ,314 312 viewport : client.viewport, viewport : client.viewport,extensions/the-system/mockup-tool.ts Modified +31 / −12 text lines
1 1 import { randomUUID } from "node:crypto" ;import { randomUUID } from "node:crypto" ;2 - import { access, mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises" ;10 + } from "node:fs/promises" ;3 11 import { homedir } from "node:os" ;import { homedir } from "node:os" ;4 12 import path from "node:path" ;import path from "node:path" ;157 165 if (! details) return new Text ("" , 0 , 0 ); if (! details) return new Text ("" , 0 , 0 );158 166 const annotations = details.annotations ?? []; const annotations = details.annotations ?? [];159 167 const summary = `${details. action ?? "submitted"} · ${(details. selected ?? []). join (", ") || "none"} · ${annotations. length } annotation${annotations. length === 1 ? "" : "s"}` ; const summary = `${details. action ?? "submitted"} · ${(details. selected ?? []). join (", ") || "none"} · ${annotations. length } annotation${annotations. length === 1 ? "" : "s"}` ;160 - if (! context.expanded)161 - return new Text (theme.fg ("dim" , summary), 0 , 0 );168 + if ( ! context . expanded ) return new Text (theme.fg ("dim" , summary), 0 , 0 );162 169 return new Text ( return new Text (164 171 theme.fg ("dim" , summary), theme.fg ("dim" , summary),211 218 toolCallId, toolCallId,214 - previousManifest : continuing215 - ? previous.cacheManifest221 + previousManifest : continuing ? previous.cacheManifest : undefined ,218 223 } catch (error) { } catch (error) {219 224 cacheError = error instanceof Error ? error.message : String (error); cacheError = error instanceof Error ? error.message : String (error);304 309 if (entry.type !== "message" ) continue ; if (entry.type !== "message" ) continue ;305 310 const message = entry.message; const message = entry.message;306 311 if (! isRecord (message)) continue ; if (! isRecord (message)) continue ;307 - if (message.role !== "toolResult" || message.toolName !== "mockup" ) continue ; 312 + if (message.role !== "toolResult" || message.toolName !== "mockup" )308 314 const details = message.details; const details = message.details;309 315 if (! isRecord (details) || typeof details.contextCapsule !== "string" ) if (! isRecord (details) || typeof details.contextCapsule !== "string" )310 316 return undefined ; return undefined ;375 381 function selectedLabels (entry: MockupHistoryEntry ): string {function selectedLabels (entry: MockupHistoryEntry ): string {376 382 if (entry.selected .length === 0 ) return "none" ; if (entry.selected .length === 0 ) return "none" ;377 - const labels = new Map ( entry.options .map ((option) => [option.id , option.label ])) ; 383 + const labels = new Map (384 + entry.options .map ((option) => [option.id , option.label ]), 378 386 return entry.selected return entry.selected 379 387 .map ((id) => `${id} (${labels. get (id) ?? id})` ) .map ((id) => `${id} (${labels. get (id) ?? id})` )380 388 .join (", " ); .join (", " );395 403 if (platform === "darwin" ) if (platform === "darwin" )396 404 return path.join (home, "Library" , "Caches" , "pi" , "mockups" ); return path.join (home, "Library" , "Caches" , "pi" , "mockups" );397 - return path . join ( env.XDG_CACHE_HOME ?? path.join (home, ".cache" ), " pi " , " mockups " ) ; 406 + env.XDG_CACHE_HOME ?? path.join (home, ".cache" ),400 412 type PersistInput = {type PersistInput = {433 445 `${ JSON . stringify (input.result, null, 2)}\n` , `${ JSON . stringify (input.result, null, 2)}\n` ,435 447 ... input.request.options .map ((option) => ... input.request.options .map ((option) => 436 - writeFile ( path.join (iterationDir, `${ safeSegment (option. id )}.html` ), option . html ) , 449 + path.join (iterationDir, `${ safeSegment (option. id )}.html` ),439 454 const manifest = path.join (iterationDir, "manifest.json" ); const manifest = path.join (iterationDir, "manifest.json" );474 489 ): Promise <void> {): Promise <void> {475 490 const sessions = await directories (root ); const sessions = await directories (root );476 - const candidates: Array < { path: string; modified: number; bytes: number }> = [ ] ; 491 + const candidates: Array < { path: string; modified: number; bytes: number }> = 477 493 for (const session of sessions) { for (const session of sessions) {478 494 if (session.name === safeSegment(protectedSessionId ? ? "" )) continue; if (session.name === safeSegment(protectedSessionId ? ? "" )) continue;479 495 const metadataPath = path.join (session.path, "session.json" ); const metadataPath = path.join (session.path, "session.json" );518 534 return (await readdir (root , { withFileTypes: true })) return (await readdir (root , { withFileTypes: true }))519 535 .filter ((entry) => entry.isDirectory () && ! entry.isSymbolicLink ()) .filter ((entry) => entry.isDirectory () && ! entry.isSymbolicLink ())520 - . map ( ( entry ) => ( { name : entry . name , path: path.join (root , entry.name ) } ) ) ; 538 + path: path.join (root , entry.name ), 521 540 } catch (error) { } catch (error) {522 541 if (isNotFound (error)) return []; if (isNotFound (error)) return [];523 542 throw error; throw error;extensions/the-system/mockup.ts Modified +4 / −3 text lines
128 128 function armRoundTimeout (): void { function armRoundTimeout (): void {129 129 clearRoundTimeout (); clearRoundTimeout ();130 - timeout = setTimeout (( ) => 131 - terminate (new Error ("mockup timed out waiting for browser Submit" )),132 - DEFAULT_TIMEOUT_MS) ; 130 + timeout = setTimeout (131 + ( ) => terminate (new Error ("mockup timed out waiting for browser Submit" )),133 134 timeout.unref (); timeout.unref ();135 136 function broadcast (type: string , data: unknown ): void { function broadcast (type: string , data: unknown ): void {