@pickled-dev/cli 0.16.1 → 0.16.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.
- package/README.md +4 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,12 +76,14 @@ Run agent scenarios against registered sources.
|
|
|
76
76
|
| `-o, --output <file>` | Save JSON report to file |
|
|
77
77
|
| `-v, --verbose` | Show progress while scenarios run |
|
|
78
78
|
| `-t, --threshold <n>` | Minimum score percent needed to pass |
|
|
79
|
-
| `--target <name>` |
|
|
79
|
+
| `--target <name>` | Restrict to the named target. Overrides `matrix.target` for non-matrix scenarios; for matrix scenarios, also acts as `--interface` unless that flag is explicitly set. |
|
|
80
80
|
| `--scenario <name>` | Run only the named scenario (CI-matrix-friendly) |
|
|
81
|
-
| `--interface <name>` | Matrix cell filter: run only cells with this interface
|
|
81
|
+
| `--interface <name>` | Matrix cell filter: run only cells with this interface. Takes precedence over `--target` for matrix cells. |
|
|
82
82
|
| `--source <name>` | Matrix cell filter: run only cells with this source id |
|
|
83
83
|
| `--toolset <name>` | Matrix cell filter: run only cells with this toolset name |
|
|
84
84
|
|
|
85
|
+
`--target` and `--interface` are related but distinct: `--target` is the legacy flag that narrows the top-level `matrix.target` axis (used before per-scenario `scenario.matrix.interfaces` shipped in v0.16.0). When `--target` is the only flag passed, the CLI also applies it as `--interface` so matrix scenarios narrow consistently. Pass `--interface` explicitly to override.
|
|
86
|
+
|
|
85
87
|
The cell filters work with `scenario.matrix` declarations. Designed for GitHub Actions matrix usage where each CI job runs one cell:
|
|
86
88
|
|
|
87
89
|
```yaml
|
package/dist/index.js
CHANGED
|
@@ -163,7 +163,7 @@ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.pus
|
|
|
163
163
|
`)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
|
|
164
164
|
`,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",q=[];if(z&&Z.sep&&!Z.value){let G=[];for(let J=0;J<Z.sep.length;++J){let Q=Z.sep[J];switch(Q.type){case"newline":G.push(J);break;case"space":break;case"comment":if(Q.indent>$.indent)G.length=0;break;default:G.length=0}}if(G.length>=2)q=Z.sep.splice(G[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)q.push(this.sourceToken),$.items.push({start:q}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(z||Z.value)q.push(this.sourceToken),$.items.push({start:q,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(Z.explicitKey)if(!Z.sep)if(j0(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let G=H$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(j0(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:q,key:null,sep:[this.sourceToken]}]});else if(E8(Z.key)&&!j0(Z.sep,"newline")){let G=H$(Z.start),J=Z.key,Q=Z.sep;Q.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:J,sep:Q}]})}else if(q.length>0)Z.sep=Z.sep.concat(q,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:q,key:null,sep:[this.sourceToken]});else if(j0(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let G=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:q,key:G,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(G);else Object.assign(Z,{key:G,sep:[]}),this.onKeyLine=!0;return}default:{let G=this.startBlockValue($);if(G){if(G.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!j0(Z.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(X)$.items.push({start:q});this.stack.push(G);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||j0(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=U2(X),q=H$(z);C8($);let G=$.end.splice(1,$.end.length);G.push(this.sourceToken);let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:q,key:$,sep:G}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
|
|
165
165
|
`)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
|
|
166
|
-
`,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=U2($),X=H$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=U2($),X=H$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}mY.Parser=b8});var h8=_((rY)=>{var y8=W9(),pY=a$(),e$=n$(),lY=M4(),cY=S(),iY=M9(),x8=w9();function k8($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new iY.LineCounter||null,prettyErrors:Z}}function aY($,Z={}){let{lineCounter:X,prettyErrors:z}=k8(Z),q=new x8.Parser(X?.addNewLine),G=new y8.Composer(Z),J=Array.from(G.compose(q.parse($)));if(z&&X)for(let Q of J)Q.errors.forEach(e$.prettifyError($,X)),Q.warnings.forEach(e$.prettifyError($,X));if(J.length>0)return J;return Object.assign([],{empty:!0},G.streamInfo())}function f8($,Z={}){let{lineCounter:X,prettyErrors:z}=k8(Z),q=new x8.Parser(X?.addNewLine),G=new y8.Composer(Z),J=null;for(let Q of G.compose(q.parse($),!0,$.length))if(!J)J=Q;else if(J.options.logLevel!=="silent"){J.errors.push(new e$.YAMLParseError(Q.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)J.errors.forEach(e$.prettifyError($,X)),J.warnings.forEach(e$.prettifyError($,X));return J}function nY($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let q=f8($,X);if(!q)return null;if(q.warnings.forEach((G)=>lY.warn(q.options.logLevel,G)),q.errors.length>0)if(q.options.logLevel!=="silent")throw q.errors[0];else q.errors=[];return q.toJS(Object.assign({reviver:z},X))}function sY($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let q=Math.round(X);X=q<1?void 0:q>8?{indent:8}:{indent:q}}if($===void 0){let{keepUndefined:q}=X??Z??{};if(!q)return}if(cY.isDocument($)&&!z)return $.toString(X);return new pY.Document($,z,X).toString(X)}rY.parse=nY;rY.parseAllDocuments=aY;rY.parseDocument=f8;rY.stringify=sY});var v8=_((TU)=>{var ZU=W9(),XU=a$(),zU=s4(),P9=n$(),qU=b$(),S0=S(),GU=R0(),JU=g(),QU=A0(),YU=N0(),UU=Q2(),HU=F9(),WU=M9(),VU=w9(),H2=h8(),g8=C$();TU.Composer=ZU.Composer;TU.Document=XU.Document;TU.Schema=zU.Schema;TU.YAMLError=P9.YAMLError;TU.YAMLParseError=P9.YAMLParseError;TU.YAMLWarning=P9.YAMLWarning;TU.Alias=qU.Alias;TU.isAlias=S0.isAlias;TU.isCollection=S0.isCollection;TU.isDocument=S0.isDocument;TU.isMap=S0.isMap;TU.isNode=S0.isNode;TU.isPair=S0.isPair;TU.isScalar=S0.isScalar;TU.isSeq=S0.isSeq;TU.Pair=GU.Pair;TU.Scalar=JU.Scalar;TU.YAMLMap=QU.YAMLMap;TU.YAMLSeq=YU.YAMLSeq;TU.CST=UU;TU.Lexer=HU.Lexer;TU.LineCounter=WU.LineCounter;TU.Parser=VU.Parser;TU.parse=H2.parse;TU.parseAllDocuments=H2.parseAllDocuments;TU.parseDocument=H2.parseDocument;TU.stringify=H2.stringify;TU.visit=g8.visit;TU.visitAsync=g8.visitAsync});var S5=V5(j5(),1),{program:e0,createCommand:OV,createArgument:FV,createOption:MV,CommanderError:wV,InvalidArgumentError:PV,InvalidOptionArgumentError:RV,Command:IV,Argument:AV,Option:H4,Help:NV}=S5.default;var C5={name:"@pickled-dev/cli",version:"0.16.0",description:"Test what agents actually understand about your product",module:"dist/index.js",type:"module",bin:{pickled:"./dist/index.js"},files:["dist"],scripts:{dev:"bun run ./src/index.ts",build:"bun build ./src/index.ts --outdir ./dist --target bun --minify --external @anthropic-ai/claude-agent-sdk",release:"semantic-release"},dependencies:{commander:"^14.0.2",chalk:"^5.6.2","@anthropic-ai/claude-agent-sdk":"^0.3.0"},devDependencies:{"@pickled-dev/config":"workspace:*","@pickled-dev/core":"workspace:*","semantic-release":"^25.0.2","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","semantic-release-ai-notes":"^0.3.0"}};import qV from"path";var Q0={category:"cli",provider:"claude-code",model:"sonnet"},W4=["Read","Glob","Grep","Bash"],V4=["Edit","MultiEdit","Write","NotebookEdit"];var u8=V5(v8(),1);async function W$($){let Z=`${$}/pickled.yml`,X=Bun.file(Z);if(!await X.exists())throw Error(`pickled.yml not found in ${$}`);let z;try{let q=await X.text();z=u8.default.parse(q)}catch(q){throw Error(`Failed to parse pickled.yml: ${q}`)}return pU(z),z}function pU($){if(!$.tool?.name)throw Error("pickled.yml: 'tool.name' is required");if(!Array.isArray($.scenarios)||$.scenarios.length===0)throw Error("pickled.yml: 'scenarios' must be a non-empty array");if($.docs?.sources)for(let[X,z]of Object.entries($.docs.sources))rU(X,z);if($.toolsets){if(typeof $.toolsets!=="object"||Array.isArray($.toolsets))throw Error("pickled.yml: 'toolsets' must be an object mapping name to configuration");for(let[X,z]of Object.entries($.toolsets))if(typeof z!=="object"||z===null||Array.isArray(z))throw Error(`pickled.yml: toolsets["${X}"] must be an object`)}if($.targets)for(let[X,z]of Object.entries($.targets)){if(z.systemPrompt!==void 0)throw Error(`pickled.yml: target "${X}" sets 'systemPrompt', which bypasses the citation contract. Remove it; custom prompts are not supported in citation mode.`);if(z.provider==="codex-cli"){if(!z.model)throw Error(`pickled.yml: target "${X}" (codex-cli) requires an explicit 'model' field. Codex's default model can change without notice; pin it for reproducible evals.`);if(z.maxTurns!==void 0)throw Error(`pickled.yml: target "${X}" (codex-cli) sets 'maxTurns', but the codex CLI does not support a turn cap. Remove the field.`)}if(z.category==="api"){if(!z.model)throw Error(`pickled.yml: target "${X}" (api/${z.provider}) requires an explicit 'model' field. Pickled does not substitute a default; reproducible evals depend on pinning the model.`);let q=["allowedTools","disallowedTools","mcpServers","permissionMode","maxTurns","maxThinkingTokens","maxBudgetUsd"];for(let G of q)if(z[G]!==void 0)throw Error(`pickled.yml: target "${X}" (api/${z.provider}) sets '${G}', which only applies to CLI/Agent SDK targets. Remove the field; API targets accept only model/temperature/maxTokens/threshold.`);if(z.workspaceContext!==void 0)throw Error(`pickled.yml: target "${X}" (api/${z.provider}) sets 'workspaceContext', which only applies to IDE targets. Remove the field.`)}}let Z=new Set(Object.keys($.docs?.sources??{}));for(let X of $.scenarios){if(!X.name||!X.prompt)throw Error("pickled.yml: every scenario needs 'name' and 'prompt'");if(X.requiredSources!==void 0){if(!Array.isArray(X.requiredSources))throw Error(`pickled.yml: scenario "${X.name}" has non-array 'requiredSources'. Omit the field to skip citation scoring, or set [] for "any cited source counts".`);for(let z of X.requiredSources)if(!Z.has(z))throw Error(`pickled.yml: scenario "${X.name}" references unknown source "${z}". Declared sources: ${[...Z].join(", ")||"(none)"}`)}eU(X.name,X.traps),sU(X.name,X.compareSurfaces,Z),cU(X.name,X.matrix,Z,new Set(Object.keys($.targets??{})),new Set(Object.keys($.toolsets??{none:{}}))),iU(X.name,X.expected),aU(X.name,X.verifiers,Z),nU(X)}lU($)}function lU($){if(!$.docs?.sources)return;let Z=[];for(let[z,q]of Object.entries($.docs.sources)){if(typeof q==="string")continue;let G=q.audit?.traps;if(Array.isArray(G))Z.push({id:z,list:G})}if(Z.length===0)return;let X=new Map;for(let z of $.scenarios)for(let q of z.traps??[]){let G=X.get(q.id);if(G!==void 0)throw Error(`pickled.yml: trap id "${q.id}" is declared in both scenario "${G}" and scenario "${z.name}". Globally unique trap ids are required when any source uses list-form audit.traps suppression. Rename one of the traps.`);X.set(q.id,z.name)}for(let{id:z,list:q}of Z)for(let G of q)if(!X.has(G)){let J=[...X.keys()].join(", ")||"(none)";throw Error(`pickled.yml: docs.sources["${z}"].audit.traps lists unknown trap id "${G}". Declared trap ids: ${J}`)}}function cU($,Z,X,z,q){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" matrix must be an object with optional interfaces/sources/toolsets arrays`);let G=(J,Q,Y)=>{let U=Z[J];if(U===void 0)return;if(!Array.isArray(U))throw Error(`pickled.yml: scenario "${$}" matrix.${J} must be an array of ${Y} names`);if(U.length===0)throw Error(`pickled.yml: scenario "${$}" matrix.${J} cannot be empty (omit the field to use defaults)`);for(let W of U){if(typeof W!=="string")throw Error(`pickled.yml: scenario "${$}" matrix.${J} entries must be strings`);if(!Q.has(W))throw Error(`pickled.yml: scenario "${$}" matrix.${J} references unknown ${Y} "${W}". Declared: ${[...Q].join(", ")||"(none)"}`)}};G("interfaces",z,"target"),G("sources",X,"source"),G("toolsets",q,"toolset")}function iU($,Z){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" expected must be an object with optional includes/excludes arrays`);let X=(z)=>{let q=Z[z];if(q===void 0)return;if(!Array.isArray(q))throw Error(`pickled.yml: scenario "${$}" expected.${z} must be an array of strings`);if(q.length===0)throw Error(`pickled.yml: scenario "${$}" expected.${z} cannot be empty (omit the field instead)`);for(let G=0;G<q.length;G++)if(typeof q[G]!=="string"||q[G].length===0)throw Error(`pickled.yml: scenario "${$}" expected.${z}[${G}] must be a non-empty string`)};X("includes"),X("excludes")}function aU($,Z,X){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" verifiers must be an object`);let z=Z.sources;if(z===void 0)return;if(!Array.isArray(z))throw Error(`pickled.yml: scenario "${$}" verifiers.sources must be an array of source IDs`);for(let q of z){if(typeof q!=="string")throw Error(`pickled.yml: scenario "${$}" verifiers.sources entries must be strings`);if(!X.has(q))throw Error(`pickled.yml: scenario "${$}" verifiers.sources references unknown source "${q}"`)}}function nU($){let Z=$.requiredSources!==void 0,X=$.expected!==void 0&&($.expected.includes!==void 0&&$.expected.includes.length>0||$.expected.excludes!==void 0&&$.expected.excludes.length>0),z=$.traps!==void 0&&$.traps.length>0;if(!Z&&!X&&!z)throw Error(`pickled.yml: scenario "${$.name}" must declare at least one of requiredSources, expected.includes/excludes, or traps. A scenario with nothing to check has no verdict.`)}function sU($,Z,X){if(Z===void 0)return;if(!Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" compareSurfaces must be an array of source-id lists`);if(Z.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces cannot be empty (use a non-empty list of surfaces, or remove the field)`);for(let z=0;z<Z.length;z++){let q=Z[z];if(!Array.isArray(q))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] must be an array of source ids`);if(q.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] must be a non-empty list of source ids`);for(let G of q){if(typeof G!=="string")throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] entries must be string source ids`);if(!X.has(G))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] references unknown source "${G}". Declared sources: ${[...X].join(", ")||"(none)"}`)}}}function rU($,Z){if(typeof Z==="string"){if(Z.length===0)throw Error(`pickled.yml: docs.sources["${$}"] string form must be a non-empty file path or URL`);return}if(!Z||typeof Z!=="object")throw Error(`pickled.yml: docs.sources["${$}"] must be a string (path/URL) or an object with a 'path' field`);let X=Z;if(typeof X.path!=="string"||X.path.length===0)throw Error(`pickled.yml: docs.sources["${$}"] object form requires a non-empty 'path' field`);if(X.audit!==void 0){if(typeof X.audit!=="object"||X.audit===null)throw Error(`pickled.yml: docs.sources["${$}"].audit must be an object`);let z=X.audit;if(z.traps!==void 0){let q=z.traps;if(typeof q==="boolean");else if(Array.isArray(q)){if(q.length===0)throw Error(`pickled.yml: docs.sources["${$}"].audit.traps cannot be an empty array; use true (scan all) or false (skip all) instead`);for(let G=0;G<q.length;G++)if(typeof q[G]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].audit.traps[${G}] must be a string trap id`)}else throw Error(`pickled.yml: docs.sources["${$}"].audit.traps must be a boolean or an array of trap ids`)}for(let q of Object.keys(z))if(q!=="traps")throw Error(`pickled.yml: docs.sources["${$}"].audit has unknown field "${q}"`)}if(X.type!==void 0){if(X.type!=="file"&&X.type!=="url"&&X.type!=="codebase")throw Error(`pickled.yml: docs.sources["${$}"].type must be "file", "url", or "codebase"`)}if(X.type==="codebase"){if(typeof X.path==="string"&&X.path.split("/").includes(".."))throw Error(`pickled.yml: docs.sources["${$}"].path must not contain ".." segments. Codebase loader stays within the project root.`);if(X.exclude!==void 0){if(!Array.isArray(X.exclude))throw Error(`pickled.yml: docs.sources["${$}"].exclude must be an array of glob patterns`);for(let z=0;z<X.exclude.length;z++)if(typeof X.exclude[z]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].exclude[${z}] must be a string glob pattern`)}if(X.maxBytes!==void 0){if(typeof X.maxBytes!=="number"||!Number.isFinite(X.maxBytes)||X.maxBytes<=0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes must be a positive number of bytes`)}}else{if(X.exclude!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].exclude only applies to type: codebase sources`);if(X.maxBytes!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes only applies to type: codebase sources`)}for(let z of Object.keys(X))if(z!=="path"&&z!=="audit"&&z!=="type"&&z!=="exclude"&&z!=="maxBytes")throw Error(`pickled.yml: docs.sources["${$}"] has unknown field "${z}"`)}var oU=new Set(["g","y"]),tU=new Set(["i","m","s","u","v"]);function eU($,Z){if(Z===void 0)return;if(!Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" has non-array 'traps'`);let X=new Set;for(let z of Z){if(!z.id||typeof z.id!=="string")throw Error(`pickled.yml: scenario "${$}" has a trap missing 'id'`);if(X.has(z.id))throw Error(`pickled.yml: scenario "${$}" has duplicate trap id "${z.id}"`);if(X.add(z.id),!z.reason||typeof z.reason!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" requires non-empty 'reason'`);if(z.auditSeverity!==void 0&&z.auditSeverity!=="warning"&&z.auditSeverity!=="error")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" auditSeverity must be "warning" or "error"`);let q=typeof z.match==="string",G=typeof z.pattern==="string";if(q===G)throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" must set exactly one of 'match' or 'pattern'`);if(q){if(z.match==="")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has empty 'match'`);if(z.flags!==void 0)throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" sets 'flags' without 'pattern'`)}else{let J=z.pattern;if(typeof J!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" must set 'pattern'`);if(J==="")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has empty 'pattern'`);if(z.flags!==void 0){if(typeof z.flags!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has non-string 'flags'`);for(let Q of z.flags){if(oU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses forbidden regex flag "${Q}" (g and y are not allowed)`);if(!tU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses unsupported regex flag "${Q}"`)}}try{new RegExp(J,z.flags??"")}catch(Q){throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has invalid regex pattern: ${Q instanceof Error?Q.message:Q}`)}}}}function R9($,Z){let X=new Set([...Object.keys($.targets??{}),"default"]);if(!X.has(Z)){let z=[...X].sort().join(", ");throw Error(`Unknown target: "${Z}". Available targets: ${z}`)}return{...$,matrix:{...$.matrix,target:[Z]},scenarios:$.scenarios.filter((z)=>!z.target||z.target===Z)}}function I9($){if(typeof $==="string")return{path:$,auditTraps:!0};return{path:$.path,auditTraps:$.audit?.traps??!0}}function W2($){let{config:Z,files:X,pairs:z,findings:q}=$,G=[],J=q.filter((H)=>H.severity==="error").length,Q=q.filter((H)=>H.severity==="warning").length;if(G.push(`# Agent-context audit
|
|
166
|
+
`,Z)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let Z=U2($),X=H$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=U2($),X=H$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}mY.Parser=b8});var h8=_((rY)=>{var y8=W9(),pY=a$(),e$=n$(),lY=M4(),cY=S(),iY=M9(),x8=w9();function k8($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new iY.LineCounter||null,prettyErrors:Z}}function aY($,Z={}){let{lineCounter:X,prettyErrors:z}=k8(Z),q=new x8.Parser(X?.addNewLine),G=new y8.Composer(Z),J=Array.from(G.compose(q.parse($)));if(z&&X)for(let Q of J)Q.errors.forEach(e$.prettifyError($,X)),Q.warnings.forEach(e$.prettifyError($,X));if(J.length>0)return J;return Object.assign([],{empty:!0},G.streamInfo())}function f8($,Z={}){let{lineCounter:X,prettyErrors:z}=k8(Z),q=new x8.Parser(X?.addNewLine),G=new y8.Composer(Z),J=null;for(let Q of G.compose(q.parse($),!0,$.length))if(!J)J=Q;else if(J.options.logLevel!=="silent"){J.errors.push(new e$.YAMLParseError(Q.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)J.errors.forEach(e$.prettifyError($,X)),J.warnings.forEach(e$.prettifyError($,X));return J}function nY($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let q=f8($,X);if(!q)return null;if(q.warnings.forEach((G)=>lY.warn(q.options.logLevel,G)),q.errors.length>0)if(q.options.logLevel!=="silent")throw q.errors[0];else q.errors=[];return q.toJS(Object.assign({reviver:z},X))}function sY($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let q=Math.round(X);X=q<1?void 0:q>8?{indent:8}:{indent:q}}if($===void 0){let{keepUndefined:q}=X??Z??{};if(!q)return}if(cY.isDocument($)&&!z)return $.toString(X);return new pY.Document($,z,X).toString(X)}rY.parse=nY;rY.parseAllDocuments=aY;rY.parseDocument=f8;rY.stringify=sY});var v8=_((TU)=>{var ZU=W9(),XU=a$(),zU=s4(),P9=n$(),qU=b$(),S0=S(),GU=R0(),JU=g(),QU=A0(),YU=N0(),UU=Q2(),HU=F9(),WU=M9(),VU=w9(),H2=h8(),g8=C$();TU.Composer=ZU.Composer;TU.Document=XU.Document;TU.Schema=zU.Schema;TU.YAMLError=P9.YAMLError;TU.YAMLParseError=P9.YAMLParseError;TU.YAMLWarning=P9.YAMLWarning;TU.Alias=qU.Alias;TU.isAlias=S0.isAlias;TU.isCollection=S0.isCollection;TU.isDocument=S0.isDocument;TU.isMap=S0.isMap;TU.isNode=S0.isNode;TU.isPair=S0.isPair;TU.isScalar=S0.isScalar;TU.isSeq=S0.isSeq;TU.Pair=GU.Pair;TU.Scalar=JU.Scalar;TU.YAMLMap=QU.YAMLMap;TU.YAMLSeq=YU.YAMLSeq;TU.CST=UU;TU.Lexer=HU.Lexer;TU.LineCounter=WU.LineCounter;TU.Parser=VU.Parser;TU.parse=H2.parse;TU.parseAllDocuments=H2.parseAllDocuments;TU.parseDocument=H2.parseDocument;TU.stringify=H2.stringify;TU.visit=g8.visit;TU.visitAsync=g8.visitAsync});var S5=V5(j5(),1),{program:e0,createCommand:OV,createArgument:FV,createOption:MV,CommanderError:wV,InvalidArgumentError:PV,InvalidOptionArgumentError:RV,Command:IV,Argument:AV,Option:H4,Help:NV}=S5.default;var C5={name:"@pickled-dev/cli",version:"0.16.1",description:"Test what agents actually understand about your product",module:"dist/index.js",type:"module",bin:{pickled:"./dist/index.js"},files:["dist"],scripts:{dev:"bun run ./src/index.ts",build:"bun build ./src/index.ts --outdir ./dist --target bun --minify --external @anthropic-ai/claude-agent-sdk",release:"semantic-release"},dependencies:{commander:"^14.0.2",chalk:"^5.6.2","@anthropic-ai/claude-agent-sdk":"^0.3.0"},devDependencies:{"@pickled-dev/config":"workspace:*","@pickled-dev/core":"workspace:*","semantic-release":"^25.0.2","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","semantic-release-ai-notes":"^0.3.0"}};import qV from"path";var Q0={category:"cli",provider:"claude-code",model:"sonnet"},W4=["Read","Glob","Grep","Bash"],V4=["Edit","MultiEdit","Write","NotebookEdit"];var u8=V5(v8(),1);async function W$($){let Z=`${$}/pickled.yml`,X=Bun.file(Z);if(!await X.exists())throw Error(`pickled.yml not found in ${$}`);let z;try{let q=await X.text();z=u8.default.parse(q)}catch(q){throw Error(`Failed to parse pickled.yml: ${q}`)}return pU(z),z}function pU($){if(!$.tool?.name)throw Error("pickled.yml: 'tool.name' is required");if(!Array.isArray($.scenarios)||$.scenarios.length===0)throw Error("pickled.yml: 'scenarios' must be a non-empty array");if($.docs?.sources)for(let[X,z]of Object.entries($.docs.sources))rU(X,z);if($.toolsets){if(typeof $.toolsets!=="object"||Array.isArray($.toolsets))throw Error("pickled.yml: 'toolsets' must be an object mapping name to configuration");for(let[X,z]of Object.entries($.toolsets))if(typeof z!=="object"||z===null||Array.isArray(z))throw Error(`pickled.yml: toolsets["${X}"] must be an object`)}if($.targets)for(let[X,z]of Object.entries($.targets)){if(z.systemPrompt!==void 0)throw Error(`pickled.yml: target "${X}" sets 'systemPrompt', which bypasses the citation contract. Remove it; custom prompts are not supported in citation mode.`);if(z.provider==="codex-cli"){if(!z.model)throw Error(`pickled.yml: target "${X}" (codex-cli) requires an explicit 'model' field. Codex's default model can change without notice; pin it for reproducible evals.`);if(z.maxTurns!==void 0)throw Error(`pickled.yml: target "${X}" (codex-cli) sets 'maxTurns', but the codex CLI does not support a turn cap. Remove the field.`)}if(z.category==="api"){if(!z.model)throw Error(`pickled.yml: target "${X}" (api/${z.provider}) requires an explicit 'model' field. Pickled does not substitute a default; reproducible evals depend on pinning the model.`);let q=["allowedTools","disallowedTools","mcpServers","permissionMode","maxTurns","maxThinkingTokens","maxBudgetUsd"];for(let G of q)if(z[G]!==void 0)throw Error(`pickled.yml: target "${X}" (api/${z.provider}) sets '${G}', which only applies to CLI/Agent SDK targets. Remove the field; API targets accept only model/temperature/maxTokens/threshold.`);if(z.workspaceContext!==void 0)throw Error(`pickled.yml: target "${X}" (api/${z.provider}) sets 'workspaceContext', which only applies to IDE targets. Remove the field.`)}}let Z=new Set(Object.keys($.docs?.sources??{}));for(let X of $.scenarios){if(!X.name||!X.prompt)throw Error("pickled.yml: every scenario needs 'name' and 'prompt'");if(X.requiredSources!==void 0){if(!Array.isArray(X.requiredSources))throw Error(`pickled.yml: scenario "${X.name}" has non-array 'requiredSources'. Omit the field to skip citation scoring, or set [] for "any cited source counts".`);for(let z of X.requiredSources)if(!Z.has(z))throw Error(`pickled.yml: scenario "${X.name}" references unknown source "${z}". Declared sources: ${[...Z].join(", ")||"(none)"}`)}eU(X.name,X.traps),sU(X.name,X.compareSurfaces,Z),cU(X.name,X.matrix,Z,new Set(Object.keys($.targets??{})),new Set(Object.keys($.toolsets??{none:{}}))),iU(X.name,X.expected),aU(X.name,X.verifiers,Z),nU(X)}lU($)}function lU($){if(!$.docs?.sources)return;let Z=[];for(let[z,q]of Object.entries($.docs.sources)){if(typeof q==="string")continue;let G=q.audit?.traps;if(Array.isArray(G))Z.push({id:z,list:G})}if(Z.length===0)return;let X=new Map;for(let z of $.scenarios)for(let q of z.traps??[]){let G=X.get(q.id);if(G!==void 0)throw Error(`pickled.yml: trap id "${q.id}" is declared in both scenario "${G}" and scenario "${z.name}". Globally unique trap ids are required when any source uses list-form audit.traps suppression. Rename one of the traps.`);X.set(q.id,z.name)}for(let{id:z,list:q}of Z)for(let G of q)if(!X.has(G)){let J=[...X.keys()].join(", ")||"(none)";throw Error(`pickled.yml: docs.sources["${z}"].audit.traps lists unknown trap id "${G}". Declared trap ids: ${J}`)}}function cU($,Z,X,z,q){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" matrix must be an object with optional interfaces/sources/toolsets arrays`);let G=(J,Q,Y)=>{let U=Z[J];if(U===void 0)return;if(!Array.isArray(U))throw Error(`pickled.yml: scenario "${$}" matrix.${J} must be an array of ${Y} names`);if(U.length===0)throw Error(`pickled.yml: scenario "${$}" matrix.${J} cannot be empty (omit the field to use defaults)`);for(let W of U){if(typeof W!=="string")throw Error(`pickled.yml: scenario "${$}" matrix.${J} entries must be strings`);if(!Q.has(W))throw Error(`pickled.yml: scenario "${$}" matrix.${J} references unknown ${Y} "${W}". Declared: ${[...Q].join(", ")||"(none)"}`)}};G("interfaces",z,"target"),G("sources",X,"source"),G("toolsets",q,"toolset")}function iU($,Z){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" expected must be an object with optional includes/excludes arrays`);let X=(z)=>{let q=Z[z];if(q===void 0)return;if(!Array.isArray(q))throw Error(`pickled.yml: scenario "${$}" expected.${z} must be an array of strings`);if(q.length===0)throw Error(`pickled.yml: scenario "${$}" expected.${z} cannot be empty (omit the field instead)`);for(let G=0;G<q.length;G++)if(typeof q[G]!=="string"||q[G].length===0)throw Error(`pickled.yml: scenario "${$}" expected.${z}[${G}] must be a non-empty string`)};X("includes"),X("excludes")}function aU($,Z,X){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" verifiers must be an object`);let z=Z.sources;if(z===void 0)return;if(!Array.isArray(z))throw Error(`pickled.yml: scenario "${$}" verifiers.sources must be an array of source IDs`);for(let q of z){if(typeof q!=="string")throw Error(`pickled.yml: scenario "${$}" verifiers.sources entries must be strings`);if(!X.has(q))throw Error(`pickled.yml: scenario "${$}" verifiers.sources references unknown source "${q}"`)}}function nU($){let Z=$.requiredSources!==void 0,X=$.expected!==void 0&&($.expected.includes!==void 0&&$.expected.includes.length>0||$.expected.excludes!==void 0&&$.expected.excludes.length>0),z=$.traps!==void 0&&$.traps.length>0;if(!Z&&!X&&!z)throw Error(`pickled.yml: scenario "${$.name}" must declare at least one of requiredSources, expected.includes/excludes, or traps. A scenario with nothing to check has no verdict.`)}function sU($,Z,X){if(Z===void 0)return;if(!Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" compareSurfaces must be an array of source-id lists`);if(Z.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces cannot be empty (use a non-empty list of surfaces, or remove the field)`);for(let z=0;z<Z.length;z++){let q=Z[z];if(!Array.isArray(q))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] must be an array of source ids`);if(q.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] must be a non-empty list of source ids`);for(let G of q){if(typeof G!=="string")throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] entries must be string source ids`);if(!X.has(G))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] references unknown source "${G}". Declared sources: ${[...X].join(", ")||"(none)"}`)}}}function rU($,Z){if(typeof Z==="string"){if(Z.length===0)throw Error(`pickled.yml: docs.sources["${$}"] string form must be a non-empty file path or URL`);return}if(!Z||typeof Z!=="object")throw Error(`pickled.yml: docs.sources["${$}"] must be a string (path/URL) or an object with a 'path' field`);let X=Z;if(typeof X.path!=="string"||X.path.length===0)throw Error(`pickled.yml: docs.sources["${$}"] object form requires a non-empty 'path' field`);if(X.audit!==void 0){if(typeof X.audit!=="object"||X.audit===null)throw Error(`pickled.yml: docs.sources["${$}"].audit must be an object`);let z=X.audit;if(z.traps!==void 0){let q=z.traps;if(typeof q==="boolean");else if(Array.isArray(q)){if(q.length===0)throw Error(`pickled.yml: docs.sources["${$}"].audit.traps cannot be an empty array; use true (scan all) or false (skip all) instead`);for(let G=0;G<q.length;G++)if(typeof q[G]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].audit.traps[${G}] must be a string trap id`)}else throw Error(`pickled.yml: docs.sources["${$}"].audit.traps must be a boolean or an array of trap ids`)}for(let q of Object.keys(z))if(q!=="traps")throw Error(`pickled.yml: docs.sources["${$}"].audit has unknown field "${q}"`)}if(X.type!==void 0){if(X.type!=="file"&&X.type!=="url"&&X.type!=="codebase")throw Error(`pickled.yml: docs.sources["${$}"].type must be "file", "url", or "codebase"`)}if(X.type==="codebase"){if(typeof X.path==="string"&&X.path.split("/").includes(".."))throw Error(`pickled.yml: docs.sources["${$}"].path must not contain ".." segments. Codebase loader stays within the project root.`);if(X.exclude!==void 0){if(!Array.isArray(X.exclude))throw Error(`pickled.yml: docs.sources["${$}"].exclude must be an array of glob patterns`);for(let z=0;z<X.exclude.length;z++)if(typeof X.exclude[z]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].exclude[${z}] must be a string glob pattern`)}if(X.maxBytes!==void 0){if(typeof X.maxBytes!=="number"||!Number.isFinite(X.maxBytes)||X.maxBytes<=0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes must be a positive number of bytes`)}}else{if(X.exclude!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].exclude only applies to type: codebase sources`);if(X.maxBytes!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes only applies to type: codebase sources`)}for(let z of Object.keys(X))if(z!=="path"&&z!=="audit"&&z!=="type"&&z!=="exclude"&&z!=="maxBytes")throw Error(`pickled.yml: docs.sources["${$}"] has unknown field "${z}"`)}var oU=new Set(["g","y"]),tU=new Set(["i","m","s","u","v"]);function eU($,Z){if(Z===void 0)return;if(!Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" has non-array 'traps'`);let X=new Set;for(let z of Z){if(!z.id||typeof z.id!=="string")throw Error(`pickled.yml: scenario "${$}" has a trap missing 'id'`);if(X.has(z.id))throw Error(`pickled.yml: scenario "${$}" has duplicate trap id "${z.id}"`);if(X.add(z.id),!z.reason||typeof z.reason!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" requires non-empty 'reason'`);if(z.auditSeverity!==void 0&&z.auditSeverity!=="warning"&&z.auditSeverity!=="error")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" auditSeverity must be "warning" or "error"`);let q=typeof z.match==="string",G=typeof z.pattern==="string";if(q===G)throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" must set exactly one of 'match' or 'pattern'`);if(q){if(z.match==="")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has empty 'match'`);if(z.flags!==void 0)throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" sets 'flags' without 'pattern'`)}else{let J=z.pattern;if(typeof J!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" must set 'pattern'`);if(J==="")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has empty 'pattern'`);if(z.flags!==void 0){if(typeof z.flags!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has non-string 'flags'`);for(let Q of z.flags){if(oU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses forbidden regex flag "${Q}" (g and y are not allowed)`);if(!tU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses unsupported regex flag "${Q}"`)}}try{new RegExp(J,z.flags??"")}catch(Q){throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has invalid regex pattern: ${Q instanceof Error?Q.message:Q}`)}}}}function R9($,Z){let X=new Set([...Object.keys($.targets??{}),"default"]);if(!X.has(Z)){let z=[...X].sort().join(", ");throw Error(`Unknown target: "${Z}". Available targets: ${z}`)}return{...$,matrix:{...$.matrix,target:[Z]},scenarios:$.scenarios.filter((z)=>!z.target||z.target===Z)}}function I9($){if(typeof $==="string")return{path:$,auditTraps:!0};return{path:$.path,auditTraps:$.audit?.traps??!0}}function W2($){let{config:Z,files:X,pairs:z,findings:q}=$,G=[],J=q.filter((H)=>H.severity==="error").length,Q=q.filter((H)=>H.severity==="warning").length;if(G.push(`# Agent-context audit
|
|
167
167
|
`),G.push(`Target: \`${Z.targetRepo}\``),G.push(`Budgets: root \u2264 ${Z.budgets.rootLines} lines, nested warn at ${Z.budgets.nestedWarnLines} lines.`),G.push(`Found ${X.length} agent-doc files. ${J} error(s), ${Q} warning(s).
|
|
168
168
|
`),G.push(`## Inventory
|
|
169
169
|
`),X.length===0)G.push(`No agent-doc files found.
|
|
@@ -241,7 +241,7 @@ ${$}`,U=wW(MW(),`pickled-codex-${OW()}.txt`),W=["--ask-for-approval","never","ex
|
|
|
241
241
|
`)+X,q=z+1,z=$.indexOf(`
|
|
242
242
|
`,q)}while(z!==-1);return G+=$.slice(q),G}var{stdout:xZ,stderr:kZ}=EZ,z5=Symbol("GENERATOR"),N$=Symbol("STYLER"),O1=Symbol("IS_EMPTY"),fZ=["ansi","ansi","ansi256","ansi16m"],j$=Object.create(null),iW=($,Z={})=>{if(Z.level&&!(Number.isInteger(Z.level)&&Z.level>=0&&Z.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let X=xZ?xZ.level:0;$.level=Z.level===void 0?X:Z.level};var aW=($)=>{let Z=(...X)=>X.join(" ");return iW(Z,$),Object.setPrototypeOf(Z,F1.prototype),Z};function F1($){return aW($)}Object.setPrototypeOf(F1.prototype,Function.prototype);for(let[$,Z]of Object.entries(G0))j$[$]={get(){let X=e2(this,G5(Z.open,Z.close,this[N$]),this[O1]);return Object.defineProperty(this,$,{value:X}),X}};j$.visible={get(){let $=e2(this,this[N$],!0);return Object.defineProperty(this,"visible",{value:$}),$}};var q5=($,Z,X,...z)=>{if($==="rgb"){if(Z==="ansi16m")return G0[X].ansi16m(...z);if(Z==="ansi256")return G0[X].ansi256(G0.rgbToAnsi256(...z));return G0[X].ansi(G0.rgbToAnsi(...z))}if($==="hex")return q5("rgb",Z,X,...G0.hexToRgb(...z));return G0[X][$](...z)},nW=["rgb","hex","ansi256"];for(let $ of nW){j$[$]={get(){let{level:X}=this;return function(...z){let q=G5(q5($,fZ[X],"color",...z),G0.color.close,this[N$]);return e2(this,q,this[O1])}}};let Z="bg"+$[0].toUpperCase()+$.slice(1);j$[Z]={get(){let{level:X}=this;return function(...z){let q=G5(q5($,fZ[X],"bgColor",...z),G0.bgColor.close,this[N$]);return e2(this,q,this[O1])}}}}var sW=Object.defineProperties(()=>{},{...j$,level:{enumerable:!0,get(){return this[z5].level},set($){this[z5].level=$}}}),G5=($,Z,X)=>{let z,q;if(X===void 0)z=$,q=Z;else z=X.openAll+$,q=Z+X.closeAll;return{open:$,close:Z,openAll:z,closeAll:q,parent:X}},e2=($,Z,X)=>{let z=(...q)=>rW(z,q.length===1?""+q[0]:q.join(" "));return Object.setPrototypeOf(z,sW),z[z5]=$,z[N$]=Z,z[O1]=X,z},rW=($,Z)=>{if($.level<=0||!Z)return $[O1]?"":Z;let X=$[N$];if(X===void 0)return Z;let{openAll:z,closeAll:q}=X;if(Z.includes("\x1B"))while(X!==void 0)Z=bZ(Z,X.close,X.open),X=X.parent;let G=Z.indexOf(`
|
|
243
243
|
`);if(G!==-1)Z=yZ(Z,q,z,G);return z+Z+q};Object.defineProperties(F1.prototype,j$);var oW=F1(),cL=F1({level:kZ?kZ.level:0});var P=oW;var hZ="\u2500".repeat(55);function J5($){if($==="success")return P.green;if($==="warning")return P.yellow;return P.red}function tW($){if($>=70)return P.green;if($>=50)return P.yellow;return P.red}function Q5($){if($.label==="Error")return $.label;return`${$.label} (${$.confidence}%)`}function eW($){let Z=K0({answerable:$.answerable??"NO",confidence:$.confidence??0,traps:$.traps??{fired:[],avoided:[]},error:$.error}),X=J5(Z.tone);return{icon:X(Z.icon),status:Q5(Z),color:X}}function $V($){let Z=$.target?.target??"default",X=$.context?.name??"default";if(Z==="default"&&X==="default")return"";if(X==="default")return P.dim(`[${Z}]`);return P.dim(`[${Z}/${X}]`)}function ZV($){let Z=$.map((X)=>X.scenario.name);return new Set(Z).size!==Z.length}function $4($){return $.map((Z)=>`[${Z}]`).join(", ")}function Y5($,Z){let X=[];if($.error)return X.push(P.dim(`${Z}error: ${$.error}`)),X;if($.traps.fired.length>0)for(let z of $.traps.fired)X.push(P.red(`${Z}trap: ${z.id}`)),X.push(P.dim(`${Z}reason: ${z.reason}`)),X.push(P.dim(`${Z}match: "${z.matched}"`));else if($.reason&&$.answerable!=="YES")X.push(P.dim(`${Z}reason: ${$.reason}`));if($.citations.cited.length>0)X.push(P.dim(`${Z}cited: ${$4($.citations.cited)}`));if($.citations.missing.length>0)X.push(P.dim(`${Z}missing: ${$4($.citations.missing)}`));if($.citations.unknown.length>0)X.push(P.dim(`${Z}unknown: ${$4($.citations.unknown)}`));return X}function gZ($,Z){if(!$.traps||!$.citations)return[];return Y5({error:$.error,traps:$.traps,reason:$.reason??"",answerable:$.answerable??"NO",citations:$.citations},Z)}function vZ($){let{icon:Z,status:X,color:z}=eW($),q=$V($),G=`${Z} ${X}`;return q?`${q} ${z(G)}`:z(G)}function uZ($,Z){if(!$.cells)return[];let X=[];X.push(`${Z}${P.dim("Matrix cells (interface \xB7 source \xB7 toolset)")}`);for(let z of $.cells){let q=K0(z),G=J5(q.tone),J=`[${z.cell.interface} \xB7 ${z.cell.source??"-"} \xB7 ${z.cell.toolset}]`,Q=P.dim(J),Y=`${G(q.icon)} ${G(Q5(q))}`;if(X.push(`${Z}${Q} ${Y}`),X.push(...Y5({traps:z.traps,reason:z.reason,answerable:z.answerable,citations:z.citations??{cited:[],required:[],missing:[],unknown:[]}},`${Z} `)),z.expected){let U=z.expected.includes.filter((H)=>!H.satisfied).map((H)=>`"${H.value}"`),W=z.expected.excludes.filter((H)=>!H.satisfied).map((H)=>`"${H.value}"`);if(U.length>0)X.push(P.dim(`${Z} expected.includes missing: ${U.join(", ")}`));if(W.length>0)X.push(P.dim(`${Z} expected.excludes hit: ${W.join(", ")}`))}}if($.verifierSamples&&$.verifierSamples.length>0){X.push(`${Z}${P.dim("Verifier samples (human review; never LLM-judged)")}`);for(let z of $.verifierSamples){let q=z.content.slice(0,200).replace(/\s+/g," ").trim(),G=z.content.length>200?"...":"";X.push(P.dim(`${Z} [${z.id}] ${z.name}`)),X.push(P.dim(`${Z} ${q}${G}`))}}return X}function mZ($,Z){if(!$.surfaces)return[];let X=[];X.push(`${Z}${P.dim("Citations scoped to active surface (compare mode)")}`);for(let z of $.surfaces){let q=K0(z),G=J5(q.tone),J=P.dim(`[${z.active.join(",")}]`),Q=`${G(q.icon)} ${G(Q5(q))}`;X.push(`${Z}${J} ${Q}`),X.push(...Y5({traps:z.traps,reason:z.reason,answerable:z.answerable,citations:z.citations},`${Z} `))}return X}function XV($){let Z=0,X=0,z=0;for(let q of $){if(q.surfaces){for(let G of q.surfaces)Z+=G.traps.fired.length,X+=G.citations.missing.length,z+=G.citations.unknown.length;continue}if(q.traps)Z+=q.traps.fired.length;if(q.citations)X+=q.citations.missing.length,z+=q.citations.unknown.length}if(Z>0&&X+z>0)return"Review fired traps and citation gaps.";if(Z>0)return"Review fired traps before trusting this surface.";if(X+z>0)return"Review missing and unknown citations.";return"Citations hold. No declared traps fired."}function zV($,Z){let X=$.summary.score,q=`Overall: ${tW(X)(`${X}`)} / 100`;if(Z===void 0||Z<=0)return q;let J=X>=Z?P.green("run passes"):P.red("run fails");return`${q} \xB7 threshold ${Z} \xB7 ${J}`}function dZ($,Z={}){let{tool:X,scenarios:z,summary:q}=$,G=z,J=[];if(J.push(P.bold("pickled check")),J.push(hZ),J.push(`Tool: ${P.cyan(X.name)}`),$.docs.length>0)J.push(`Sources: ${P.dim($4($.docs.map((Q)=>Q.id)))}`);else J.push(`Sources: ${P.dim("none registered")}`);if(J.push(`Scenarios: ${P.dim(String(q.total))}`),J.push(""),ZV(G)){let Q=new Map;for(let Y of G){let U=Y.scenario.name;if(!Q.has(U))Q.set(U,[]);Q.get(U)?.push(Y)}for(let[Y,U]of Q){J.push(`Scenario: ${Y}`);for(let W of U)if(W.cells)J.push(...uZ(W," "));else if(W.surfaces)J.push(...mZ(W," "));else J.push(` ${vZ(W)}`),J.push(...gZ(W," "));J.push("")}}else for(let Q of G){if(J.push(`Scenario: ${Q.scenario.name}`),Q.cells)J.push(...uZ(Q," "));else if(Q.surfaces)J.push(...mZ(Q," "));else J.push(` ${vZ(Q)}`),J.push(...gZ(Q," "));J.push("")}return J.push(hZ),J.push(zV($,Z.threshold)),J.push(P.dim(XV(z))),J.join(`
|
|
244
|
-
`)}function U5($,Z={}){console.log(dZ($,Z)),console.log()}function Z4($,Z={}){if(Z.verbose)return JSON.stringify($,null,2);let X={...$,docs:$.docs.map((z)=>({...z,content:""})),scenarios:$.scenarios.map((z)=>{let{allResponses:q,...
|
|
244
|
+
`)}function U5($,Z={}){console.log(dZ($,Z)),console.log()}function Z4($,Z={}){if(Z.verbose)return JSON.stringify($,null,2);let X={...$,docs:$.docs.map((z)=>({...z,content:""})),scenarios:$.scenarios.map((z)=>{let{allResponses:q,verifierSamples:G,cells:J,surfaces:Q,...Y}=z;return{...Y,verifierSamples:G?.map((U)=>({...U,content:""})),cells:J?.map((U)=>{let{allResponses:W,...H}=U;return H}),surfaces:Q?.map((U)=>{let{allResponses:W,...H}=U;return H})}})};return JSON.stringify(X,null,2)}function GV($){if($.format&&$.format!=="terminal")return $.format;if($.json)return"json";return $.format??"terminal"}async function pZ($,Z){let{output:X}=Z,z=GV(Z),q=qV.resolve($),G;try{G=await O2({targetRepo:q})}catch(H){console.error(P.red(H instanceof Error?H.message:H)),process.exit(1)}let J;if(z==="json")J=V2(G);else if(z==="markdown")J=W2(G);else J=T2(G);if(X)await Bun.write(X,J);else await JV(`${J}
|
|
245
245
|
`);let Q=G.findings.filter((H)=>H.severity==="error").length,Y=G.findings.filter((H)=>H.severity==="warning").length;if(z!=="json"&&!X)if(console.log(),Q===0&&Y===0)console.log(P.green("Audit clean. No issues found."));else{let H=Q>0?P.red:P.yellow;console.log(H(`Audit found ${Q} error(s), ${Y} warning(s).`))}if((Z.failOn??"error")==="warning"?Q+Y>0:Q>0)process.exit(1)}function JV($){return new Promise((Z,X)=>{process.stdout.write($,(z)=>{if(z)X(z);else Z()})})}import QV from"path";async function lZ($,Z){let{json:X,output:z,verbose:q}=Z,G=(T)=>!X&&console.log(T),J=QV.resolve($),Q;try{Q=await W$(J)}catch(T){console.error(P.red(T instanceof Error?T.message:T)),console.error(),console.error(P.dim("Run `pickled init` to create a config file")),process.exit(1)}if(Z.target){let T=Q.scenarios.length;try{Q=R9(Q,Z.target)}catch(D){console.error(P.red(D instanceof Error?D.message:String(D))),process.exit(1)}let K=T-Q.scenarios.length;if(K>0&&!X)G(P.dim(`Skipping ${K} scenario(s) with explicit target != "${Z.target}"`))}let Y={name:Q.tool.name,description:Q.tool.description,path:J};if(q){G(P.bold("pickled check")),G(""),G(P.dim(` Tool: ${Y.name}`)),G(P.dim(` Scenarios: ${Q.scenarios.length}`));for(let T of Q.scenarios)G(P.dim(` - ${T.name}`))}let U=Z.interface??Z.target,W=U||Z.source||Z.toolset?{interface:U,source:Z.source,toolset:Z.toolset}:void 0,H=Z.scenario?[Z.scenario]:void 0,V=await Z5(Y,Q,{onProgress:q?(T)=>{if(!X)G(P.dim(` ${T}`))}:void 0,cellFilter:W,scenarioFilter:H}),B=Z.threshold?parseInt(Z.threshold,10):Q.threshold??0,L=B>0&&V.summary.score<B;if(z)await Bun.write(z,Z4(V,{verbose:q}));else if(X)await YV(`${Z4(V,{verbose:q})}
|
|
246
246
|
`);else U5(V,{threshold:B});if(L){if(X||z)console.error(P.red(`Overall: ${V.summary.score} / 100 \xB7 threshold ${B} \xB7 run fails`)),console.error(P.dim("Review failed scenarios before trusting this surface."));process.exit(1)}}function YV($){return new Promise((Z,X)=>{process.stdout.write($,(z)=>{if(z)X(z);else Z()})})}import UV from"path";var HV=`# pickled.yml - Agent legibility check for your product
|
|
247
247
|
|