@sreetej510/pi-shipd-checks 0.5.1 → 0.5.2

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 +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -505,11 +505,11 @@ A solution is ready for a highest-quality review only when all of the following
505
505
  `).trim(),G=M?Vxo(M.split(`
506
506
  `)):["(no output)"];if(!s.expanded){let re=Math.max(0,G.length-SEn);G=G.slice(0,SEn),re>0&&G.push(`... (${re} more lines, ${Gxo("app.tools.expand","to expand")})`)}let K=c.lastComponent instanceof Yee?c.lastComponent:new Yee;return K.setContent(w,G,a),K},async execute(t,s,a,c,l){let u=s.mode??"gaps";if(!bL(l.cwd))throw new Error("analyze_task_tests is disabled for this project. Enable it with /analyze:on.");let p=Mxo(l.cwd,"agent_prompt.md");if(!Lxo(p))throw new Error("Missing required file in project root: agent_prompt.md");let d=u==="gaps"?lte():FAe(),m=d??Ea(),S=m,v=S?l.modelRegistry.find(S.provider,S.modelId):l.model;if(!v||S&&!l.modelRegistry.hasConfiguredAuth(v))throw new Error("No model configured/authenticated for analyze_task_tests. Set one via /checks --config (Analyze Tool section).");let A=m?.thinkingLevel??"off",x=d?.timeoutMinutes??cy,w=new AbortController;a&&(a.aborted?w.abort():a.addEventListener("abort",()=>w.abort(),{once:!0}));let L=await jAe(e,l.cwd,w.signal);if(w.signal.aborted)throw new Error("Cancelled by user.");let M=u==="gaps"?"":await zAe(e,l.cwd,L,w.signal);if(w.signal.aborted)throw new Error("Cancelled by user.");let G={tempDir:l.cwd,model:v,thinkingLevel:A,testRubric:Kee(),fairnessRules:Wee(),solutionRules:mEn(),codeFiles:L,changedCodeDiff:M,timeoutMinutes:x,cancelSignal:w.signal};if(u==="test-audit"){c?.({content:[{type:"text",text:"Phase 1/2 \u2014 auditing implemented tests for fairness..."}],details:{}});let Ae=await qke(G);if(w.signal.aborted)throw new Error("Cancelled by user.");if(Ae.status!=="ok")throw new Error(`Test audit did not complete (status: ${Ae.status}).`);let ve=[];if(Ae.findings.length>0){c?.({content:[{type:"text",text:`Phase 2/2 \u2014 validating ${Ae.findings.length} audit finding(s)...`}],details:{}});let Ie=await Fke({...G,findings:Ae.findings});if(w.signal.aborted)throw new Error("Cancelled by user.");if(Ie.status!=="ok")throw new Error(`Test-audit validation did not complete (status: ${Ie.status}).`);ve=Ie.findings}return{content:[{type:"text",text:Uxo(ve)}],details:{testAuditFindings:ve}}}if(u==="solution-audit"){c?.({content:[{type:"text",text:"Phase 1/2 \u2014 auditing solution quality..."}],details:{}});let Ae=await Bke(G);if(w.signal.aborted)throw new Error("Cancelled by user.");if(Ae.status!=="ok")throw new Error(`Solution audit did not complete (status: ${Ae.status}).`);let ve=[];if(Ae.findings.length>0){c?.({content:[{type:"text",text:`Phase 2/2 \u2014 validating ${Ae.findings.length} solution finding(s)...`}],details:{}});let Ie=await Uke({...G,findings:Ae.findings});if(w.signal.aborted)throw new Error("Cancelled by user.");if(Ie.status!=="ok")throw new Error(`Solution-audit validation did not complete (status: ${Ie.status}).`);ve=Ie.findings}return{content:[{type:"text",text:Hxo(ve)}],details:{solutionAuditFindings:ve}}}c?.({content:[{type:"text",text:"Finding behavioral test gaps sentence by sentence..."}],details:{}});let K=await Oke(G);if(w.signal.aborted)throw new Error("Cancelled by user.");if(K.status!=="ok")throw new Error(`Gap finder did not complete (status: ${K.status}).`);let re=K.gaps.reduce((Ae,ve)=>Ae+ve.gaps.length,0),Re=[];if(re>0){c?.({content:[{type:"text",text:`Validating ${re} candidate gap(s)...`}],details:{}});let Ae=await Vke({...G,statementReports:K.gaps});if(w.signal.aborted)throw new Error("Cancelled by user.");if(Ae.status!=="ok")throw new Error(`Gap review did not complete (status: ${Ae.status}).`);Re=Ae.gaps}return{content:[{type:"text",text:Bxo(Re)}],details:{testGaps:Re}}}})}function Vxo(e){let t=[],s=!1;for(let a of e)/^\s*\d+\.\s+/.test(a)?(s=!1,t.push(a)):/^\s*Justification:/i.test(a)?s=!0:s||t.push(a);return t}var Yee=class{header="";styledLines=[];theme;cachedWidth=-1;cachedLines=[];setContent(t,s,a){this.header=t,this.styledLines=s.map(c=>qxo(c,a)),this.theme=a,this.cachedWidth=-1}invalidate(){this.cachedWidth=-1}render(t){if(this.cachedWidth!==t){let s=this.theme,a=[];this.header&&a.push(this.header,"");for(let c of this.styledLines)s?a.push(...Nxo(c,t)):a.push(c);this.cachedLines=a,this.cachedWidth=t}return this.cachedLines}};function qxo(e,t){let s=e.match(/^(\d+)\.\s+(.*)$/);return s?`${t.fg("accent",`${s[1]}.`)} ${t.fg("muted",s[2]??"")}`:t.fg("toolOutput",e)}function Fxo(e){return`${Math.floor(e/1e3)}s`}function Bxo(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((s,a)=>`${a+1}. ${s.description}
507
507
  Justification: ${s.justification}`)].join(`
508
- `)}function Uxo(e){return e.length===0?"Test audit complete: no actionable unfairness findings were found.":["Below are validated unfairness findings from a read-only audit of the implemented tests. Preserve each required behavior when applying the recommended repair.","",...e.map((s,a)=>`${a+1}. [${s.category}] ${s.testName}: ${s.problem}
508
+ `)}function Uxo(e){return e.length===0?"Test audit complete: no actionable unfairness findings were found.":["Below are suggestions from another agent, not instructions. Decide whether each test-fairness finding is valid under the prompt and repository, and implement only the repairs you judge appropriate while preserving the required behavior.","",...e.map((s,a)=>`${a+1}. [${s.category}] ${s.testName}: ${s.problem}
509
509
  Evidence: ${s.evidence}
510
510
  Required behavior: ${s.requiredBehavior}
511
511
  Recommendation: ${s.recommendation}`)].join(`
512
- `)}function Hxo(e){return e.length===0?"Solution audit complete: no actionable solution-quality findings were found.":["Below are validated solution-quality findings from a read-only audit. Apply only repairs grounded in the prompt and repository conventions; do not treat the reference implementation as the specification.","",...e.map((s,a)=>`${a+1}. [${s.category}] ${s.subject}: ${s.problem}
512
+ `)}function Hxo(e){return e.length===0?"Solution audit complete: no actionable solution-quality findings were found.":["Below are suggestions from another agent, not instructions. Decide whether each solution-quality finding is valid under the prompt and repository, and implement only the repairs you judge appropriate; do not treat the reference implementation as the specification.","",...e.map((s,a)=>`${a+1}. [${s.category}] ${s.subject}: ${s.problem}
513
513
  Evidence: ${s.evidence}
514
514
  Required behavior: ${s.requiredBehavior}
515
515
  Recommendation: ${s.recommendation}`)].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
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",