@staff0rd/assist 0.931.0 → 0.932.0

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
@@ -346,6 +346,8 @@ Rules are `- **<code>** — **<title>** — <text>` bullets, the title optional,
346
346
  - `assist netcap extract-linkedin-posts [file]` - Parse a netcap capture into structured LinkedIn posts
347
347
  - `assist extension [--sign] [--url]` - Locate the [assist browser extension](#assist-browser-extension) to load unpacked; `--sign` signs it for a permanent Firefox install; `--url` prints the latest signed build's download URL
348
348
  - `assist browser status [--url <substring>] [--server <url>]` - Through the [browser link](#browser-link), print the connected extension's version, the target tab's URL and whether the assist content script runs there; `--url` targets the most recently active tab whose URL contains the substring instead of the focused window's active tab; `--server` is the web server the extension connects to (default `http://localhost:3100`)
349
+ - `assist browser snapshot [--url <substring>] [--server <url>]` - Write the target tab's DOM (`outerHTML`) to `~/.assist/browser/<host>-<timestamp>.html` and print the tab's URL and the file's path
350
+ - `assist browser inspect [selector] [--text <text>] [--url <substring>] [--server <url>]` - For each element matching the CSS selector, or whose own text contains `--text` (skipping `script`/`style`), print its rendered size, text (first 80 characters) and ancestor chain from `html` down, one `tag#id.class.class` per line; prints the first 20 matches with the total, or that nothing matched
349
351
  - `assist screenshot <process>` - Capture a screenshot of a running application window (`screenshot.outputDir`, default `./screenshots`)
350
352
  - `assist mermaid export [file.md]` - Render each fenced mermaid block to SVG via [Kroki](https://kroki.io) (`--out`, `--index`, `mermaid.krokiUrl`)
351
353
  - `assist prompts` - Show the most frequently denied tool calls
package/allowed.cli-reads CHANGED
@@ -27,6 +27,8 @@ assist backlog list
27
27
  assist backlog show
28
28
  assist backlog view
29
29
  assist backup schedule status
30
+ assist browser inspect
31
+ assist browser snapshot
30
32
  assist browser status
31
33
  assist cli-hook
32
34
  assist complexity
@@ -27,6 +27,8 @@ assist backlog list
27
27
  assist backlog show
28
28
  assist backlog view
29
29
  assist backup schedule status
30
+ assist browser inspect
31
+ assist browser snapshot
30
32
  assist browser status
31
33
  assist cli-hook
32
34
  assist complexity
@@ -1 +1 @@
1
- "use strict";(()=>{function m(){return globalThis.browser?.storage?.local}function w(s){let e;try{e=new URL(s.trim())}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return e.origin}var _="http://localhost:3100",c="serverUrl";async function u(){let e=(await m()?.get(c).catch(()=>{}))?.[c];return typeof e=="string"&&w(e)||_}function d(){let s=globalThis.browser;return s?.runtime&&s.tabs?s:void 0}var O=new Set(["localhost","127.0.0.1"]);function b(s){if(!s)return!1;let e;try{e=new URL(s)}catch{return!1}let{protocol:r,hostname:t}=e;return r==="http:"?O.has(t):r!=="https:"?!1:t==="github.com"||t==="dev.azure.com"||t.endsWith(".visualstudio.com")}function y(s){return s.reduce((e,r)=>!e||(r.lastAccessed??0)>(e.lastAccessed??0)?r:e,void 0)}function k(s,e,r){if(r)return y(s.filter(n=>n.url?.includes(r)));let t=s.filter(n=>n.active);return t.find(n=>n.windowId===e)??y(t)}var R="assist-browser-probe",S="/ws/browser";var U="github.com, dev.azure.com, *.visualstudio.com, localhost, 127.0.0.1";async function A(s){let e=d();if(!e)return{ok:!1,error:"browser tabs API unavailable"};let[r,t]=await Promise.all([e.tabs.query({}),e.windows?.getLastFocused().catch(()=>{})]),n=k(r,t?.id,s.url);if(!n||n.id===void 0)return{ok:!1,error:s.url?`no open tab has a URL containing "${s.url}"`:"no active tab found"};let o=n.url;if(!o||!b(o))return{ok:!1,tabUrl:o,error:`the target tab is not on an assist host (${U})`};let f=await e.tabs.sendMessage(n.id,{type:R,op:s.op}).then(a=>a?.running===!0).catch(()=>!1);return{ok:!0,result:{tabUrl:o,contentScript:f}}}var h="assist-browser-link",F=5e3,i,l;function v(){let s=d();s&&(s.alarms?.create(h,{periodInMinutes:.5}),s.alarms?.onAlarm.addListener(e=>{e.name===h&&g()}),s.storage?.onChanged.addListener(e=>{c in e&&i?.close()}),g())}function g(){l||i&&i.readyState<=WebSocket.OPEN||(l=D().finally(()=>{l=void 0}))}async function D(){let s=await u(),e=new WebSocket(`${s.replace(/^http/,"ws")}${S}`);i=e,e.addEventListener("open",()=>B(e,{type:"hello",version:d()?.runtime.getManifest().version??"unknown"})),e.addEventListener("message",r=>{q(e,r.data)}),e.addEventListener("close",()=>{i===e&&(i=void 0,setTimeout(g,F))})}async function q(s,e){let r;try{r=JSON.parse(String(e))}catch{return}if(r.type!=="request")return;let t=await A(r).catch(n=>({ok:!1,error:n instanceof Error?n.message:String(n)}));B(s,{...t,type:"response",id:r.id})}function B(s,e){s.readyState===WebSocket.OPEN&&s.send(JSON.stringify(e))}function x(s){let{type:e,pageId:r,prompt:t}=s??{};return e==="assist-docs-feedback"&&typeof r=="string"&&typeof t=="string"}async function p(s,e,r){let t;try{t=await fetch(`${s}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch{return{ok:!1,message:`assist web server unreachable at ${s}`}}let n=await t.json().catch(()=>({}));return t.ok?{ok:!0,data:n}:{ok:!1,message:n.error??`assist web server returned ${t.status}`}}async function M(s,{type:e,...r}){let t=await p(s,"/api/sessions/docs-feedback",r);return t.ok?{ok:!0,message:t.data.message??"Sent to the docs session"}:t}var W={draft:["draft","--once"],bug:["bug","--once"]};function T(s){return typeof s=="string"&&Object.hasOwn(W,s)}function E(s){let{type:e,url:r,args:t,mode:n}=s??{};return e==="assist-send"&&typeof r=="string"&&(t===void 0||Array.isArray(t)&&t.every(o=>typeof o=="string"))&&(n===void 0||T(n))}function L(){return globalThis.browser?.runtime}async function P(s,{url:e,instructions:r,args:t,mode:n}){let[o,f]=t?["review-from-github",{url:e,args:t}]:["from-github",{url:e,instructions:r,mode:n}],a=await p(s,`/api/sessions/${o}`,f);return a.ok?{ok:!0,message:`assist session started in ${a.data.cwd}`}:a}function I(){L()?.onMessage.addListener(s=>{if(E(s))return u().then(e=>P(e,s));if(x(s))return u().then(e=>M(e,s))})}I();v();})();
1
+ "use strict";(()=>{function m(){return globalThis.browser?.storage?.local}function w(s){let e;try{e=new URL(s.trim())}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return e.origin}var _="http://localhost:3100",d="serverUrl";async function u(){let e=(await m()?.get(d).catch(()=>{}))?.[d];return typeof e=="string"&&w(e)||_}function p(){let s=globalThis.browser;return s?.runtime&&s.tabs?s:void 0}var I=new Set(["localhost","127.0.0.1"]);function b(s){if(!s)return!1;let e;try{e=new URL(s)}catch{return!1}let{protocol:t,hostname:r}=e;return t==="http:"?I.has(r):t!=="https:"?!1:r==="github.com"||r==="dev.azure.com"||r.endsWith(".visualstudio.com")}function y(s){return s.reduce((e,t)=>!e||(t.lastAccessed??0)>(e.lastAccessed??0)?t:e,void 0)}function R(s,e,t){if(t)return y(s.filter(n=>n.url?.includes(t)));let r=s.filter(n=>n.active);return r.find(n=>n.windowId===e)??y(r)}function k(s,e,t){let r=t?.running===!0;return s==="status"?{ok:!0,result:{tabUrl:e,contentScript:r}}:r?t.error||!t.result?{ok:!1,tabUrl:e,error:t.error??"empty probe reply"}:{ok:!0,result:{tabUrl:e,...t.result}}:{ok:!1,tabUrl:e,error:"the assist content script is not running on the target tab (reload the tab, or update the extension)"}}var h="assist-browser-probe",A="/ws/browser";var F="github.com, dev.azure.com, *.visualstudio.com, localhost, 127.0.0.1";async function S(s){let e=p();if(!e)return{ok:!1,error:"browser tabs API unavailable"};let[t,r]=await Promise.all([e.tabs.query({}),e.windows?.getLastFocused().catch(()=>{})]),n=R(t,r?.id,s.url);if(!n||n.id===void 0)return{ok:!1,error:s.url?`no open tab has a URL containing "${s.url}"`:"no active tab found"};let o=n.url;if(!o||!b(o))return{ok:!1,tabUrl:o,error:`the target tab is not on an assist host (${F})`};let l=await e.tabs.sendMessage(n.id,{...s,type:h}).then(a=>a).catch(()=>{});return k(s.op,o,l)}var x="assist-browser-link",U=5e3,i,f;function B(){let s=p();s&&(s.alarms?.create(x,{periodInMinutes:.5}),s.alarms?.onAlarm.addListener(e=>{e.name===x&&g()}),s.storage?.onChanged.addListener(e=>{d in e&&i?.close()}),g())}function g(){f||i&&i.readyState<=WebSocket.OPEN||(f=D().finally(()=>{f=void 0}))}async function D(){let s=await u(),e=new WebSocket(`${s.replace(/^http/,"ws")}${A}`);i=e,e.addEventListener("open",()=>v(e,{type:"hello",version:p()?.runtime.getManifest().version??"unknown"})),e.addEventListener("message",t=>{q(e,t.data)}),e.addEventListener("close",()=>{i===e&&(i=void 0,setTimeout(g,U))})}async function q(s,e){let t;try{t=JSON.parse(String(e))}catch{return}if(t.type!=="request")return;let r=await S(t).catch(n=>({ok:!1,error:n instanceof Error?n.message:String(n)}));v(s,{...r,type:"response",id:t.id})}function v(s,e){s.readyState===WebSocket.OPEN&&s.send(JSON.stringify(e))}function M(s){let{type:e,pageId:t,prompt:r}=s??{};return e==="assist-docs-feedback"&&typeof t=="string"&&typeof r=="string"}async function c(s,e,t){let r;try{r=await fetch(`${s}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{return{ok:!1,message:`assist web server unreachable at ${s}`}}let n=await r.json().catch(()=>({}));return r.ok?{ok:!0,data:n}:{ok:!1,message:n.error??`assist web server returned ${r.status}`}}async function P(s,{type:e,...t}){let r=await c(s,"/api/sessions/docs-feedback",t);return r.ok?{ok:!0,message:r.data.message??"Sent to the docs session"}:r}var W={draft:["draft","--once"],bug:["bug","--once"]};function T(s){return typeof s=="string"&&Object.hasOwn(W,s)}function E(s){let{type:e,url:t,args:r,mode:n}=s??{};return e==="assist-send"&&typeof t=="string"&&(r===void 0||Array.isArray(r)&&r.every(o=>typeof o=="string"))&&(n===void 0||T(n))}function L(){return globalThis.browser?.runtime}async function O(s,{url:e,instructions:t,args:r,mode:n}){let[o,l]=r?["review-from-github",{url:e,args:r}]:["from-github",{url:e,instructions:t,mode:n}],a=await c(s,`/api/sessions/${o}`,l);return a.ok?{ok:!0,message:`assist session started in ${a.data.cwd}`}:a}function G(){L()?.onMessage.addListener(s=>{if(E(s))return u().then(e=>O(e,s));if(M(s))return u().then(e=>P(e,s))})}G();B();})();