@sreetej510/pi-shipd-checks 0.1.26 → 0.1.27
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/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -324,7 +324,7 @@ Keep changes separated when possible:\r
|
|
|
324
324
|
- Avoid unrelated dependency or lockfile changes.\r
|
|
325
325
|
- Regenerate patches after every prompt/test/solution change.\r
|
|
326
326
|
\r
|
|
327
|
-
---`;function La(){return(Sf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??Sf).trim()}function qa(){return Av.trim()}var ja=!1,yn;function Fa(){return ja}function Of(){return ja=!0,yn=new AbortController,yn}function Pf(){ja=!1,yn=void 0}function Af(){return!ja||!yn||yn.signal.aborted?!1:(yn.abort(),!0)}import{existsSync as Cv}from"node:fs";import{join as Mv}from"node:path";import{keyHint as Lv}from"@earendil-works/pi-coding-agent";import{Text as qv,wrapTextWithAnsi as jv}from"@earendil-works/pi-tui";var mr="analyze_test_gaps",Cf=6;function Mf(e){e.registerTool({name:mr,label:"Gap Finder",description:"
|
|
327
|
+
---`;function La(){return(Sf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??Sf).trim()}function qa(){return Av.trim()}var ja=!1,yn;function Fa(){return ja}function Of(){return ja=!0,yn=new AbortController,yn}function Pf(){ja=!1,yn=void 0}function Af(){return!ja||!yn||yn.signal.aborted?!1:(yn.abort(),!0)}import{existsSync as Cv}from"node:fs";import{join as Mv}from"node:path";import{keyHint as Lv}from"@earendil-works/pi-coding-agent";import{Text as qv,wrapTextWithAnsi as jv}from"@earendil-works/pi-tui";var mr="analyze_test_gaps",Cf=6;function Mf(e){e.registerTool({name:mr,label:"Gap Finder",description:"Only call this when the user explicitly asks for gap analysis or asks you to run Gap Finder. Run a sequential, sentence-by-sentence behavioral test-gap analysis on the current task and its repository source files: a read-only finder agent iterates through every sentence in agent_prompt.md 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. For an explicitly requested iterative workflow, the caller should apply the returned gaps as tests and invoke this tool again sequentially.",promptSnippet:"When asked, analyze the task's hidden tests for behavioral coverage gaps",promptGuidelines:["Call analyze_test_gaps only when the user explicitly asks you to find/analyze test gaps or run Gap Finder; do not call it proactively or for unrelated work.","Run one analysis at a time and wait for it to finish; never issue multiple analyze_test_gaps calls in parallel.","If the user asks for repeated or iterative gap finding, after each result apply the confirmed gaps as tests, then run analyze_test_gaps again sequentially; repeat until a pass finds no new fair gaps, or the gaps are non-trivial or the user says to stop. The tool is read-only, so the caller performs the test changes."],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 qv("",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?Gv(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(`
|
|
328
328
|
`).trim(),te=H?Fv(H.split(`
|
|
329
329
|
`)):["(no output)"];if(!n.expanded){let ue=Math.max(0,te.length-Cf);te=te.slice(0,Cf),ue>0&&te.push(`... (${ue} more lines, ${Lv("app.tools.expand","to expand")})`)}let ne=a.lastComponent instanceof Da?a.lastComponent:new Da;return ne.setContent(E,te,r),ne},async execute(t,n,r,a,i){if(!fr(i.cwd))throw new Error("analyze_test_gaps is disabled for this project. Enable it with /analyze:on.");let m=Mv(i.cwd,"agent_prompt.md");if(!Cv(m))throw new Error("Missing required file in project root: agent_prompt.md");let u=ji()??ve(),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:La(),fairnessRules:qa(),cancelSignal:$.signal};a?.({content:[{type:"text",text:"Finding behavioral test gaps sentence by sentence..."}],details:{}});let A=await Ca(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 Ma({...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:Nv(te)}],details:{testGaps:te}}}})}function Fv(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 Da=class{header="";styledLines=[];theme;cachedWidth=-1;cachedLines=[];setContent(t,n,r){this.header=t,this.styledLines=n.map(a=>Dv(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(...jv(a,t)):r.push(a);this.cachedLines=r,this.cachedWidth=t}return this.cachedLines}};function Dv(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 Gv(e){return`${Math.floor(e/1e3)}s`}function Nv(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}
|
|
330
330
|
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.
|
|
3
|
+
"version": "0.1.27",
|
|
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",
|