@sreetej510/pi-shipd-checks 0.1.24 → 0.1.25

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -319,7 +319,7 @@ Keep changes separated when possible:\r
319
319
  - Avoid unrelated dependency or lockfile changes.\r
320
320
  - Regenerate patches after every prompt/test/solution change.\r
321
321
  \r
322
- ---`;function Aa(){return(If.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??If).trim()}function Ca(){return wv.trim()}var Ma=!1,fn;function La(){return Ma}function bf(){return Ma=!0,fn=new AbortController,fn}function vf(){Ma=!1,fn=void 0}function $f(){return!Ma||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}import{existsSync as Ev}from"node:fs";import{join as Rv}from"node:path";import{keyHint as Sv}from"@earendil-works/pi-coding-agent";import{Text as Ov,wrapTextWithAnsi as Pv}from"@earendil-works/pi-tui";var ir="analyze_test_gaps",Tf=6;function kf(e){e.registerTool({name:ir,label:"Gap Finder",description:"Run the sentence-by-sentence behavioral test-gap analysis on the current task and its repository source files: a read-only finder agent splits agent_prompt.md into sentences and proposes missing positive/negative behavioral tests per sentence, then a read-only fairness reviewer filters out unfair or internally-observable candidates (skipped when the finder found nothing). Returns the confirmed gaps as the tool result (details.testGaps). Never writes or modifies files.",promptSnippet:"Analyze the task's hidden tests for behavioral coverage gaps",promptGuidelines:["Use analyze_test_gaps when you need the confirmed list of fair behavioral test gaps for the current task's hidden tests."],parameters:D.Object({}),renderCall(t,n,r){let a=r.state;r.executionStarted&&a.startedAt===void 0&&(a.startedAt=Date.now(),a.endedAt=void 0);let i=r.lastComponent??new Ov("",0,0);return i.setText(""),i},renderResult(t,n,r,a){let i=a.state;i.startedAt!==void 0&&n.isPartial&&!i.interval&&(i.interval=setInterval(()=>a.invalidate(),1e3)),(!n.isPartial||a.isError)&&(i.endedAt??=Date.now(),i.interval&&(clearInterval(i.interval),i.interval=void 0));let m=n.isPartial?"Elapsed":"Took",u=i.endedAt??Date.now(),l=i.startedAt!==void 0?Mv(u-i.startedAt):"\u2014",f=t.details,h=Array.isArray(f?.testGaps)?f.testGaps.length:void 0,$=h===void 0?"gaps \u2014":`${h} gap${h===1?"":"s"}`,E=r.fg("toolTitle",r.bold("Gap Finder"))+r.fg("muted",` ${m} ${l} \xB7 ${$}`),H=(t.content??[]).map(ue=>ue.type==="text"?ue.text:"").join(`
322
+ ---`;function Aa(){return(If.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??If).trim()}function Ca(){return wv.trim()}var Ma=!1,fn;function La(){return Ma}function bf(){return Ma=!0,fn=new AbortController,fn}function vf(){Ma=!1,fn=void 0}function $f(){return!Ma||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}import{existsSync as Ev}from"node:fs";import{join as Rv}from"node:path";import{keyHint as Sv}from"@earendil-works/pi-coding-agent";import{Text as Ov,wrapTextWithAnsi as Pv}from"@earendil-works/pi-tui";var ir="analyze_test_gaps",Tf=6;function kf(e){e.registerTool({name:ir,label:"Gap Finder",description:"Run the sentence-by-sentence behavioral test-gap analysis on the current task and its repository source files: a read-only finder agent splits agent_prompt.md into sentences and proposes missing positive/negative behavioral tests per sentence, then a read-only fairness reviewer filters out unfair or internally-observable candidates (skipped when the finder found nothing). Returns the confirmed gaps as the tool result (details.testGaps). Never writes or modifies files.",promptSnippet:"Analyze the task's hidden tests for behavioral coverage gaps",promptGuidelines:["Use analyze_test_gaps when you need the confirmed list of fair behavioral test gaps for the current task's hidden tests."],parameters:D.Object({}),renderCall(t,n,r){let a=r.state;r.executionStarted&&a.startedAt===void 0&&(a.startedAt=Date.now(),a.endedAt=void 0);let i=r.lastComponent??new Ov("",0,0);return i.setText(""),i},renderResult(t,n,r,a){let i=a.state;i.startedAt!==void 0&&n.isPartial&&!i.interval&&(i.interval=setInterval(()=>a.invalidate(),1e3)),(!n.isPartial||a.isError)&&(i.endedAt??=Date.now(),i.interval&&(clearInterval(i.interval),i.interval=void 0));let m=n.isPartial?"Elapsed":"Took",u=i.endedAt??Date.now(),l=i.startedAt!==void 0?Mv(u-i.startedAt):"\u2014",f=t.details,h=Array.isArray(f?.testGaps)?f.testGaps.length:void 0,$=[`${m} ${l}`];h!==void 0&&$.push(`${h} gap${h===1?"":"s"}`);let E=r.fg("toolTitle",r.bold("Gap Finder"))+r.fg("muted",` ${$.join(" \xB7 ")}`),H=(t.content??[]).map(ue=>ue.type==="text"?ue.text:"").join(`
323
323
  `).trim(),te=H?Av(H.split(`
324
324
  `)):["(no output)"];if(!n.expanded){let ue=Math.max(0,te.length-Tf);te=te.slice(0,Tf),ue>0&&te.push(`... (${ue} more lines, ${Sv("app.tools.expand","to expand")})`)}let ne=a.lastComponent instanceof qa?a.lastComponent:new qa;return ne.setContent(E,te,r),ne},async execute(t,n,r,a,i){if(!xn())throw new Error("analyze_test_gaps is disabled. Enable it via /checks --config (Analyze Tool section -> Enabled).");let m=Rv(i.cwd,"agent_prompt.md");if(!Ev(m))throw new Error("Missing required file in project root: agent_prompt.md");let u=Ri()??Ee(),l=u,f=l?i.modelRegistry.find(l.provider,l.modelId):i.model;if(!f||l&&!i.modelRegistry.hasConfiguredAuth(f))throw new Error("No model configured/authenticated for analyze_test_gaps. Set one via /checks --config (Analyze Tool section).");let h=u?.thinkingLevel??"off",$=new AbortController;r&&(r.aborted?$.abort():r.addEventListener("abort",()=>$.abort(),{once:!0}));let E={tempDir:i.cwd,model:f,thinkingLevel:h,testRubric:Aa(),fairnessRules:Ca(),cancelSignal:$.signal};a?.({content:[{type:"text",text:"Finding behavioral test gaps sentence by sentence..."}],details:{}});let A=await Oa(E);if($.signal.aborted)throw new Error("Cancelled by user.");if(A.status!=="ok")throw new Error(`Gap finder did not complete (status: ${A.status}).`);let H=A.gaps.reduce((ne,ue)=>ne+ue.gaps.length,0),te=[];if(H>0){a?.({content:[{type:"text",text:`Validating ${H} candidate gap(s)...`}],details:{}});let ne=await Pa({...E,statementReports:A.gaps});if($.signal.aborted)throw new Error("Cancelled by user.");if(ne.status!=="ok")throw new Error(`Gap review did not complete (status: ${ne.status}).`);te=ne.gaps}return{content:[{type:"text",text:Lv(te)}],details:{testGaps:te}}}})}function Av(e){let t=[],n=!1;for(let r of e)/^\s*\d+\.\s+/.test(r)?(n=!1,t.push(r)):/^\s*Justification:/i.test(r)?n=!0:n||t.push(r);return t}var qa=class{header="";styledLines=[];theme;cachedWidth=-1;cachedLines=[];setContent(t,n,r){this.header=t,this.styledLines=n.map(a=>Cv(a,r)),this.theme=r,this.cachedWidth=-1}invalidate(){this.cachedWidth=-1}render(t){if(this.cachedWidth!==t){let n=this.theme,r=[];this.header&&r.push(this.header,"");for(let a of this.styledLines)n?r.push(...Pv(a,t)):r.push(a);this.cachedLines=r,this.cachedWidth=t}return this.cachedLines}};function Cv(e,t){let n=e.match(/^(\d+)\.\s+(.*)$/);return n?`${t.fg("accent",`${n[1]}.`)} ${t.fg("muted",n[2]??"")}`:t.fg("toolOutput",e)}function Mv(e){return`${Math.floor(e/1e3)}s`}function Lv(e){return e.length===0?"Gap analysis complete: no confirmed behavioral test gaps were found.":["Below are the gaps found by another agent. If they are fair under our prompt, we need to add tests to fix the gap. If not fair, do not mind those \u2014 only add tests for gaps that are absolutely fair.","",...e.map((n,r)=>`${r+1}. ${n.description}
325
325
  Justification: ${n.justification}`)].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Pi extension that runs a strict, multi-agent fairness review of a benchmark task's agent_prompt.md, test.patch, and solution.patch, plus behavioral test-gap analysis, via /checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",