@principal-ai/quality-lens-cli 0.1.17 → 0.1.19

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/cli.js CHANGED
@@ -973,14 +973,14 @@ Make sure that all grammar rule definitions are done before 'performSelfAnalysis
973
973
  `+_.map(c=>c.message).join(`
974
974
  `)),this.errors=_}},Wsr=class extends OR{constructor(_){super(_)}},alt=Ao.default.build("{{digit}}{4}",{digit:aE}),olt=Ao.default.build("{{digit}}{2}",{digit:aE}),clt=Ao.default.build("{{digit}}{2}",{digit:aE}),ult=/[Tt ]/,yFe=Ao.default.build("{{digit}}{2}",{digit:aE}),vFe=Ao.default.build("{{digit}}{2}",{digit:aE}),llt=Ao.default.build("{{digit}}{2}",{digit:aE}),Usr=Ao.default.build("\\.{{digit}}+",{digit:aE}),Vsr=Ao.default.build("[+-]{{timeHour}}:{{timeMinute}}",{timeHour:yFe,timeMinute:vFe}),Gsr=Ao.default.build("[Zz]|{{timeNumOffset}}",{timeNumOffset:Vsr}),DFe=Ao.default.build("{{timeHour}}:{{timeMinute}}:{{timeSecond}}{{timeSecFrac}}?",{timeHour:yFe,timeMinute:vFe,timeSecond:llt,timeSecFrac:Usr}),bFe=Ao.default.build("{{dateFullYear}}-{{dateMonth}}-{{dateMDay}}",{dateFullYear:alt,dateMonth:olt,dateMDay:clt}),$sr=Ao.default.build("{{partialTime}}{{timeOffset}}",{partialTime:DFe,timeOffset:Gsr}),Hsr=Ao.default.build("{{fullDate}}{{timeDelim}}{{fullTime}}",{fullDate:bFe,timeDelim:ult,fullTime:$sr}),Ksr=Ao.default.build("{{fullDate}}{{timeDelim}}{{partialTime}}",{fullDate:bFe,timeDelim:ult,partialTime:DFe}),Qsr=bFe,flt=DFe,Xsr=Ao.default.build("{{offsetDateTime}}|{{localDateTime}}|{{localDate}}|{{localTime}}",{offsetDateTime:Hsr,localDateTime:Ksr,localDate:Qsr,localTime:flt}),Qae=Gu({name:"DateTime",pattern:Xsr}),Ysr=_=>{let c=Ao.default.build("({{dateFullYear}})-({{dateMonth}})-({{dateMDay}})",{dateFullYear:alt,dateMonth:olt,dateMDay:clt}),p=Ao.default.exec(_,c);if(p){let g=Number(p[1]),S=Number(p[2]),w=Number(p[3]),z=new Date(g,S-1,w);return z.getFullYear()===g&&z.getMonth()+1===S&&z.getDate()===w}return!0},Zsr=_=>{let c=Ao.default.build("({{timeHour}}):({{timeMinute}}):({{timeSecond}})",{timeHour:yFe,timeMinute:vFe,timeSecond:llt}),p=Ao.default.exec(_,c);if(p){let g=Number(p[1]),S=Number(p[2]),w=Number(p[3]),z=new Date(0,0,0,g,S,w);return z.getHours()===g&&z.getMinutes()===S&&z.getSeconds()===w}return!0},ear=_=>Ysr(_)&&Zsr(_);P1(Qae,_=>{var c;if(!ear(_))throw new OR(`Invalid date time: ${_}`);return((c=_.match(flt))==null?void 0:c.index)===0?_:new Date(_)});var _lt=Gu({name:"DotSeparator",pattern:/\./,label:"."}),fFe=Gu({name:"ExpressionNewLine",pattern:Sk}),tar=slt,plt=Ao.default.build("{{digit}}({{digit}}|{{underscore}}{{digit}})*",{digit:aE,underscore:KV}),rar=Ao.default.build("({{minus}}|{{plus}})?{{zeroPrefixableInt}}",{minus:hFe,plus:gFe,zeroPrefixableInt:plt}),nar=Ao.default.build("[Ee]{{floatExpPart}}",{floatExpPart:rar}),iar=/\./,sar=Ao.default.build("{{decimalPoint}}{{zeroPrefixableInt}}",{decimalPoint:iar,zeroPrefixableInt:plt}),aar=/inf/,oar=/nan/,car=Ao.default.build("({{minus}}|{{plus}})?({{inf}}|{{nan}})",{minus:hFe,plus:gFe,inf:aar,nan:oar}),uar=Ao.default.build("{{floatIntPart}}({{exp}}|{{frac}}{{exp}}?)|{{specialFloat}}",{floatIntPart:tar,exp:nar,frac:sar,specialFloat:car}),Xae=Gu({name:"Float",pattern:uar}),lar=_=>_==="inf"||_==="+inf"?1/0:_==="-inf"?-1/0:_==="nan"||_==="+nan"||_==="-nan"?NaN:null;P1(Xae,_=>{let c=lar(_);if(c!==null)return c;let p=_.replace(/_/g,"");return parseFloat(p)});var far=/}/,_Fe=Gu({name:"InlineTableClose",pattern:far,label:"}",pop_mode:!0}),_ar=/{/,dlt=Gu({name:"InlineTableOpen",pattern:_ar,label:"{",push_mode:"InlineTable"}),par=/,/,mlt=Gu({name:"InlineTableSep",pattern:par,label:",",pop_mode:!0,push_mode:"InlineTable"}),QV=Gu({name:"Integer",pattern:z_.NA});P1(QV,GV);var CFe=Gu({name:"KeyValueSeparator",pattern:/=/,label:"=",push_mode:"Value"}),hlt=Gu({name:"Newline",pattern:Sk,pop_mode:!0}),Ck=Gu({name:"SimpleKey",pattern:z_.NA});P1(Ck,GV);var glt=Gu({name:"StdTableClose",pattern:/]/,label:"]",push_mode:"Value"}),ylt=Gu({name:"StdTableOpen",pattern:/\[/,label:"["}),a7=Gu({name:"String",pattern:z_.NA});P1(a7,GV);var dar=Ao.default.build("{{whiteSpaceChar}}+",{whiteSpaceChar:LR}),vlt=Gu({name:"WhiteSpace",pattern:dar,group:z_.SKIPPED}),mar=Ao.default.build("^{{whiteSpaceChar}}*{{newline}}(?:{{whiteSpaceChar}}|{{newline}})*",{whiteSpaceChar:LR,newline:Sk}),har=_=>{let c=Ao.default.exec(_,mar);return c?c[0].length:0},Dlt=_=>{let c="";for(let p=0;p<_.length;p++){let g=_[p];if(g==="\\"){p++;let S=har(_.slice(p));if(S>0){p+=S-1;continue}switch(_[p]){case"b":c+="\b";break;case"t":c+=" ";break;case"n":c+=`
975
975
  `;break;case"f":c+="\f";break;case"r":c+="\r";break;case'"':c+='"';break;case"\\":c+="\\";break;case"u":{let w=_.slice(p+1,p+5),z=parseInt(w,16);if(z>55295&&z<57344)throw new OR(`Invalid Unicode code point: \\u${w}`);c+=String.fromCodePoint(z),p+=4;break}case"U":{let w=_.slice(p+1,p+9),z=parseInt(w,16);if(z>1114111)throw new OR(`Invalid Unicode code point: \\U${w}`);c+=String.fromCodePoint(z),p+=8;break}case _.match(/^[0-7]{1,3}$/):}}else c+=g}return c},blt=_=>_.substring(3,_.length-3).replace(/^(\r\n|\n)/,""),gar=Ao.default.build("{{quotationMark}}{3}",{quotationMark:dFe}),yar=Ao.default.build("{{whiteSpaceChar}}|!|[#-\\x5B]|[\\x5D-~]|{{nonAscii}}",{whiteSpaceChar:LR,nonAscii:HV}),Dar=Ao.default.build("{{multiLineBasicUnescaped}}|{{escaped}}",{multiLineBasicUnescaped:yar,escaped:ilt}),bar=Ao.default.build("{{whiteSpaceChar}}*",{whiteSpaceChar:LR}),Car=Ao.default.build("{{escape}}{{whiteSpace}}{{newline}}({{whiteSpaceChar}}|{{newline}})*",{escape:rlt,whiteSpace:bar,newline:Sk,whiteSpaceChar:LR}),Sar=Ao.default.build("{{multiLineBasicChar}}|{{newline}}|{{multiLineBasicEscapedNewline}}",{multiLineBasicChar:Dar,newline:Sk,multiLineBasicEscapedNewline:Car}),Ear=Ao.default.build("{{quotationMark}}{1,2}",{quotationMark:dFe}),xar=Ao.default.build("{{multiLineBasicContent}}*({{multiLineBasicQuotes}}{{multiLineBasicContent}}+)*{{multiLineBasicQuotes}}?",{multiLineBasicContent:Sar,multiLineBasicQuotes:Ear}),Clt=Gu({name:"MultiLineBasicString",pattern:Ao.default.build("{{multiLineBasicStringDelimiter}}{{newline}}?{{multiLineBasicBody}}{{multiLineBasicStringDelimiter}}",{multiLineBasicStringDelimiter:gar,newline:Sk,multiLineBasicBody:xar}),label:'"""MultiLineBasicString"""',categories:[a7],line_breaks:!0});P1(Clt,_=>{let c=blt(_);return Dlt(c)});var Tar=Ao.default.build("{{apostrophe}}{3}",{apostrophe:mFe}),Aar=Ao.default.build(" |[ -&]|[\\x28-~]|{{nonAscii}}",{nonAscii:HV}),Far=Ao.default.build("{{multiLineLiteralChar}}|{{newline}}",{multiLineLiteralChar:Aar,newline:Sk}),kar=Ao.default.build("{{apostrophe}}{1,2}",{apostrophe:mFe}),Iar=Ao.default.build("{{multiLineLiteralContent}}*({{multiLineLiteralQuotes}}{{multiLineLiteralContent}}+)*{{multiLineLiteralQuotes}}?",{multiLineLiteralContent:Far,multiLineLiteralQuotes:kar}),Slt=Gu({name:"MultiLineLiteralString",pattern:Ao.default.build("{{multiLineLiteralStringDelimiter}}{{newline}}?{{multiLineLiteralBody}}{{multiLineLiteralStringDelimiter}}",{multiLineLiteralStringDelimiter:Tar,newline:Sk,multiLineLiteralBody:Iar}),label:"'''MultiLineLiteralString'''",categories:[a7],line_breaks:!0});P1(Slt,blt);var SFe=Gu({name:"QuotedKey",pattern:z_.NA,categories:[Ck]});P1(SFe,GV);var war=Ao.default.build("{{whiteSpaceChar}}|!|[#-\\x5B]|[\\x5D-~]|{{nonAscii}}",{whiteSpaceChar:LR,nonAscii:HV}),Par=Ao.default.build("{{basicUnescaped}}|{{escaped}}",{basicUnescaped:war,escaped:ilt}),EFe=Gu({name:"BasicString",pattern:Ao.default.build("{{quotationMark}}{{basicChar}}*{{quotationMark}}",{quotationMark:dFe,basicChar:Par}),label:'"BasicString"',categories:[SFe,a7]});P1(EFe,_=>{let c=_.slice(1,-1);return Dlt(c)});var Nar=Ao.default.build(" |[ -&]|[\\x28-~]|{{nonAscii}}",{nonAscii:HV}),xFe=Gu({name:"LiteralString",pattern:Ao.default.build("{{apostrophe}}{{literalChar}}*{{apostrophe}}",{apostrophe:mFe,literalChar:Nar}),label:"'LiteralString'",categories:[SFe,a7]});P1(xFe,_=>_.slice(1,-1));var Oar=/0x/,Lar=/0o/,Rar=/0b/,Mar=/[0-7]/,Bar=/[01]/,jar=Ao.default.build("{{hexPrefix}}{{hexDigit}}({{hexDigit}}|{{underscore}}{{hexDigit}})*",{hexPrefix:Oar,hexDigit:nlt,underscore:KV}),Jar=Ao.default.build("{{octPrefix}}{{digit0_7}}({{digit0_7}}|{{underscore}}{{digit0_7}})*",{octPrefix:Lar,digit0_7:Mar,underscore:KV}),qar=Ao.default.build("{{binPrefix}}{{digit0_1}}({{digit0_1}}|{{underscore}}{{digit0_1}})*",{binPrefix:Rar,digit0_1:Bar,underscore:KV}),zar=Ao.default.build("{{hexInteger}}|{{octalInteger}}|{{binaryInteger}}",{hexInteger:jar,octalInteger:Jar,binaryInteger:qar}),Elt=Gu({name:"NonDecimalInteger",pattern:zar,categories:[QV]}),War=(_,c)=>{let p=BigInt(0);for(let g=0;g<_.length;g++){let S=_[g],w=parseInt(S,c);p=p*BigInt(c)+BigInt(w)}return p},Uar=_=>{if(_.startsWith("0x"))return 16;if(_.startsWith("0o"))return 8;if(_.startsWith("0b"))return 2};P1(Elt,_=>{let c=_.replace(/_/g,"").slice(2),p=Uar(_),g=parseInt(c,p);return Number.isSafeInteger(g)?g:War(c,p)});var xlt=Gu({name:"DecimalInteger",pattern:slt,categories:[QV]});P1(xlt,_=>{let c=_.replace(/_/g,""),p=parseInt(c);return Number.isSafeInteger(p)?p||0:BigInt(c)});var Var=/[a-zA-Z]/,Gar=Ao.default.build("({{alpha}}|{{digit}}|-|_)+",{alpha:Var,digit:aE}),Tlt=Gu({name:"UnquotedKey",pattern:Gar,categories:[Ck]});P1(Tlt,_=>_);var $ar=/#/,Har=Ao.default.build(" |[ -~]|{{nonAscii}}",{nonAscii:HV}),Kar=Ao.default.build("{{commentStartChar}}{{nonEol}}*",{commentStartChar:$ar,nonEol:Har}),Alt=Gu({name:"Comment",pattern:Kar,group:"comment"}),Qar=/true/,Flt=Gu({name:"True",pattern:Qar,label:"true",categories:[$V]});P1(Flt,()=>!0);var Xar=/false/,klt=Gu({name:"False",pattern:Xar,label:"false",categories:[$V]});P1(klt,()=>!1);var Yar=Gu({name:"IgnoredNewline",pattern:Sk,group:z_.SKIPPED}),Zar=Gu({name:"InlineTableKeyValSep",pattern:/=/,label:"=",push_mode:"Value",pop_mode:!0,categories:[CFe]}),$ut=[vlt,EFe,xFe,Tlt,_lt,Ck],Hut=[vlt,Clt,Slt,EFe,xFe,Flt,klt,Qae,Xae,Elt,xlt,Yut,dlt,Alt],Ilt={modes:{Key:[Alt,fFe,CFe,tlt,elt,ylt,glt,...$ut],Value:[...Hut,hlt,mlt,_Fe],Array:[...Hut,Yar,Zut,Xut],InlineTable:[...$ut,Zar,_Fe]},defaultMode:"Key"},eor=new z_(Ilt,{ensureOptimizations:!0,skipValidations:!Kae.isDebug(),traceInitPerf:Kae.isDebug()}),tor=class extends YU{toml=this.RULE("toml",()=>{this.MANY(()=>this.CONSUME(fFe)),this.MANY1(()=>{this.SUBRULE1(this.expression),this.OPTION2(()=>{this.CONSUME1(hlt),this.MANY3(()=>this.CONSUME2(fFe))})})});valueCache;dottedKey=this.RULE("dottedKey",()=>{this.CONSUME(Ck),this.AT_LEAST_ONE(()=>{this.CONSUME(_lt),this.CONSUME1(Ck)})});key=this.RULE("key",()=>{this.OR({MAX_LOOKAHEAD:2,DEF:[{ALT:()=>this.SUBRULE(this.dottedKey)},{ALT:()=>this.CONSUME(Ck)}]})});inlineTableKeyValues=this.RULE("inlineTableKeyValues",()=>{this.MANY_SEP({SEP:mlt,DEF:()=>this.SUBRULE(this.keyValue)})});inlineTable=this.RULE("inlineTable",()=>{this.CONSUME(dlt),this.OPTION(()=>this.SUBRULE(this.inlineTableKeyValues)),this.CONSUME(_Fe)});array=this.RULE("array",()=>{this.CONSUME(Yut),this.OPTION(()=>this.SUBRULE(this.arrayValues)),this.CONSUME(Xut)});value=this.RULE("value",()=>{this.OR(this.valueCache||(this.valueCache=[{ALT:()=>this.CONSUME(a7)},{ALT:()=>this.CONSUME($V)},{ALT:()=>this.SUBRULE(this.array)},{ALT:()=>this.SUBRULE(this.inlineTable)},{ALT:()=>this.CONSUME(Qae)},{ALT:()=>this.CONSUME(Xae)},{ALT:()=>this.CONSUME(QV)}]))});keyValue=this.RULE("keyValue",()=>{this.SUBRULE(this.key),this.CONSUME(CFe),this.SUBRULE(this.value)});arrayValues=this.RULE("arrayValues",()=>{this.SUBRULE(this.value);let _=!0;this.MANY({GATE:()=>_,DEF:()=>{this.CONSUME(Zut),this.OPTION(()=>this.SUBRULE1(this.value))||(_=!1)}})});stdTable=this.RULE("stdTable",()=>{this.CONSUME(ylt),this.SUBRULE(this.key),this.CONSUME(glt)});arrayTable=this.RULE("arrayTable",()=>{this.CONSUME(tlt),this.SUBRULE(this.key),this.CONSUME(elt)});table=this.RULE("table",()=>{this.OR([{ALT:()=>this.SUBRULE(this.stdTable)},{ALT:()=>this.SUBRULE(this.arrayTable)}])});expression=this.RULE("expression",()=>{this.OR([{ALT:()=>this.SUBRULE(this.keyValue)},{ALT:()=>this.SUBRULE(this.table)}])});constructor(){super(Ilt,{traceInitPerf:Kae.isDebug(),maxLookahead:1,skipValidations:!Kae.isDebug()}),this.performSelfAnalysis()}},VV=new tor,Kut=_=>_&&(_.constructor===Object||_.constructor===void 0),Hae=()=>Object.create(null),uFe=(_,c)=>{try{return _()}catch(p){if(p instanceof NR)throw new Wsr(c)}},NR=class extends Error{},ror=VV.getBaseCstVisitorConstructor(),lFe=Symbol("explicitlyDeclared"),Qut=Symbol("implicitlyDeclared"),UV=Symbol("notEditable"),nor=class extends ror{constructor(){super(),this.validateVisitor()}toml(_){var c;let p=Hae(),g=p;return(c=_.expression)==null||c.forEach(S=>g=this.visit(S,{current:g,root:p})),this.cleanInternalProperties(p),p}expression(_,{current:c,root:p}){if(_.keyValue)return this.visit(_.keyValue,c),c;if(_.table)return this.visit(_.table,p)}keyValue(_,c){let p=this.visit(_.key),g=this.visit(_.value);uFe(()=>this.assignValue(p,g,c),`Cannot assign value to '${p.join(".")}'`)}key(_){return _.dottedKey?this.visit(_.dottedKey):[this.interpret(_,Ck)]}dottedKey(_){return this.interpret(_,Ck)}inlineTableKeyValues(_,c){_.keyValue&&_.keyValue.forEach(p=>this.visit(p,c))}inlineTable(_){let c=Hae();return c[UV]=!0,_.inlineTableKeyValues&&this.visit(_.inlineTableKeyValues,c),c}value(_){return _.array?this.visit(_.array):_.inlineTable?this.visit(_.inlineTable):this.interpret(_,a7,Xae,$V,Qae,QV)}arrayValues(_,c){return _.value.forEach(p=>c.push(this.visit(p))),c}array(_){let c=[];return c[UV]=!0,_.arrayValues?this.visit(_.arrayValues,c):c}table(_,c){if(_.stdTable)return this.visit(_.stdTable,c);if(_.arrayTable)return this.visit(_.arrayTable,c)}stdTable(_,c){let p=this.visit(_.key);return uFe(()=>this.createTable(p,c),`Cannot create table '${p.join(".")}'`)}arrayTable(_,c){let p=this.visit(_.key);return uFe(()=>{let g=this.getOrCreateArray(p,c);if(g[UV])throw new NR;let S=Hae();return g.push(S),S},`Cannot create array table '${p.join(".")}'`)}cleanInternalProperties(_){for(let c of Object.getOwnPropertySymbols(_))delete _[c];for(let c in _)typeof _[c]=="object"&&this.cleanInternalProperties(_[c]),Array.isArray(_[c])&&_[c].forEach(p=>this.cleanInternalProperties(p))}interpret(_,...c){for(let p of c)if(_[p.name]){let g=_[p.name].map(S=>pFe[p.name](S.image,S,p.name));return g.length===1?g[0]:g}}assignPrimitiveValue(_,c,p){if(_ in p)throw new NR;return Kut(c)&&(c[lFe]=!0),p[_]=c,p}tryCreatingObject(_,c,p,g,S){if(c[_]){if(!Kut(c[_])||!S&&c[_][lFe]||!g&&c[_][Qut]||c[_][UV])throw new NR}else c[_]=Hae(),p&&(c[_][p]=!0);return c[_]}assignValue(_,c,p){let[g,...S]=_;return S.length>0?(this.tryCreatingObject(g,p,Qut,!0,!1),this.assignValue(S,c,p[g])):this.assignPrimitiveValue(g,c,p)}createTable(_,c){let[p,...g]=_;if(g.length>0){if(Array.isArray(c[p])){if(c[p][UV])throw new NR;let S=c[p][c[p].length-1];return this.createTable(g,S)}return this.tryCreatingObject(p,c,null,!0,!0),this.createTable(g,c[p])}return this.tryCreatingObject(p,c,lFe,!1,!1)}getOrCreateArray(_,c){let[p,...g]=_;if(g.length>0){if(Array.isArray(c[p])){let S=c[p][c[p].length-1];return this.getOrCreateArray(g,S)}return this.tryCreatingObject(p,c,null,!0,!0),this.getOrCreateArray(g,c[p])}if(c[p]&&!Array.isArray(c[p]))throw new NR;return c[p]=c[p]||[],c[p]}},ior=new nor,TFe=_=>{let c=eor.tokenize(_);if(c.errors.length>0)throw new qsr(c.errors);VV.input=c.tokens;let p=VV.toml();if(VV.errors.length>0)throw new zsr(VV.errors);return ior.visit(p)};var dft=Iy(pft(),1);var pcr={eslint:"linting",biome:"linting",oxlint:"linting",typescript:"types",flow:"types",test:"tests",jest:"tests",vitest:"tests",mocha:"tests",playwright:"tests",cypress:"tests",prettier:"formatting",knip:"deadCode",depcheck:"deadCode",typedoc:"documentation",jsdoc:"documentation",alexandria:"documentation"},dcr=["eslint","typescript","test","prettier","knip","typedoc","alexandria"],mcr={lint:"eslint",eslint:"eslint",typecheck:"typescript","type-check":"typescript",tsc:"typescript",test:"test",jest:"jest",vitest:"vitest",format:"prettier",prettier:"prettier",knip:"knip",unused:"knip",docs:"alexandria",alexandria:"alexandria",typedoc:"typedoc"},tG=class{static detectLensCommands(c){let p=new Map;for(let g of c)if(g.name.startsWith("lens:")){let S=g.name.split(":");if(S.length>=3){let w=S[1],z=S[2];p.has(w)||p.set(w,{lensId:w,operations:new Set}),p.get(w).operations.add(z),g.isLensCommand=!0,g.lensId=w,g.lensOperation=z}}return p.size===0&&this.applyFallbackDetection(c,p),p}static applyFallbackDetection(c,p){for(let g of c){let S=mcr[g.name];if(S){p.has(S)||p.set(S,{lensId:S,operations:new Set});let w=g.name.includes("coverage")?"coverage":"check";p.get(S).operations.add(w),g.isLensCommand=!0,g.lensId=S,g.lensOperation=w}}}static calculateMetrics(c,p){let g={};for(let[S]of c){let w=pcr[S];if(w){let z=p?.get(S);z!==void 0&&(g[w]=z)}}return g}static getAvailableLenses(c){return Array.from(c.keys())}static getMissingLenses(c){let p=new Set(c.keys());return dcr.filter(g=>!p.has(g))}static calculateQualityProfile(c,p){let g=this.detectLensCommands(c),S=this.calculateMetrics(g,p),w=this.getAvailableLenses(g),z=this.getMissingLenses(g);return{hexagon:S,availableLenses:w,missingLenses:z}}};var rG=class{manifestFileName="package.json";packageType="node";canParse(c){return c.endsWith("package.json")}parseContent(c){try{return JSON.parse(c)}catch{return null}}extractPackageData(c,p){let g;p==="package.json"?g="":p.endsWith("/package.json")?g=p.slice(0,-13):g=p;let S=this.extractCommands(c,g);return{name:c.name||"unnamed",version:c.version,path:g,manifestPath:p,packageManager:"unknown",dependencies:c.dependencies||{},devDependencies:c.devDependencies||{},peerDependencies:c.peerDependencies||{},isMonorepoRoot:!!c.workspaces,isWorkspace:!1,parentPackage:void 0,availableCommands:S}}extractCommands(c,p){let g=[];return c.scripts&&Object.entries(c.scripts).forEach(([w,z])=>{g.push({name:w,command:`npm run ${w}`,description:z.length>50?z.substring(0,47)+"...":z,type:"script",workingDirectory:p})}),[{name:"install",command:"npm install",description:"Install dependencies"},{name:"ci",command:"npm ci",description:"Clean install dependencies"},{name:"update",command:"npm update",description:"Update dependencies"}].forEach(w=>{g.push({...w,type:"standard",workingDirectory:p})}),g}detectWorkspaces(c){return Array.isArray(c.workspaces)?c.workspaces:c.workspaces&&typeof c.workspaces=="object"&&"packages"in c.workspaces&&c.workspaces.packages||null}detectPackageManager(c,p){if(c.packageManager){let g=c.packageManager.split("@")[0];if(["npm","yarn","pnpm"].includes(g))return g}return p.some(g=>g.endsWith("yarn.lock"))?"yarn":p.some(g=>g.endsWith("pnpm-lock.yaml"))?"pnpm":(p.some(g=>g.endsWith("package-lock.json")),"npm")}detectConfigs(c,p,g){let S={},w={knip:["knip.json","knip.jsonc",".knip.json","knip.config.js","knip.config.ts","knip.config.mjs"],eslint:[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml","eslint.config.js","eslint.config.mjs",".eslintrc.cjs"],prettier:[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml","prettier.config.js",".prettierrc.toml"],typescript:["tsconfig.json","tsconfig.base.json"],jest:["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"],vitest:["vitest.config.js","vitest.config.ts","vitest.config.mjs"],webpack:["webpack.config.js","webpack.config.ts","webpack.config.mjs"],vite:["vite.config.js","vite.config.ts","vite.config.mjs"],rollup:["rollup.config.js","rollup.config.ts","rollup.config.mjs"],babel:[".babelrc",".babelrc.js",".babelrc.json","babel.config.js","babel.config.json"],dockerfile:["Dockerfile","dockerfile","Dockerfile.dev","Dockerfile.prod"],gitignore:[".gitignore"],editorconfig:[".editorconfig"]},z=c==="."||c===""?"":c.endsWith("/")?c:c+"/";if(p.allFiles)for(let[ie,de]of Object.entries(w))for(let be of de){let Ee=z+be;if(p.allFiles.some(Y=>Y.path===Ee||Y.relativePath===Ee)){S[ie]={path:Ee,exists:!0,type:this.getConfigFileType(be)};break}}return g&&(g.eslintConfig&&(S.eslint={path:z+"package.json",exists:!0,type:"json",isInline:!0,inlineField:"eslintConfig"}),g.prettier&&(S.prettier={path:z+"package.json",exists:!0,type:"json",isInline:!0,inlineField:"prettier"}),g.jest&&(S.jest={path:z+"package.json",exists:!0,type:"json",isInline:!0,inlineField:"jest"}),g.babel&&(S.babel={path:z+"package.json",exists:!0,type:"json",isInline:!0,inlineField:"babel"})),S}getConfigFileType(c){return c.endsWith(".json")||c.endsWith(".jsonc")?"json":c.endsWith(".yml")||c.endsWith(".yaml")?"yaml":c.endsWith(".toml")?"toml":c.endsWith(".js")||c.endsWith(".mjs")||c.endsWith(".cjs")?"js":c.endsWith(".ts")||c.endsWith(".mts")||c.endsWith(".cts")?"ts":c.endsWith(".ini")?"ini":"custom"}detectDocsFolder(c,p,g){let S=["docs","documentation","doc"],w=c==="."||c===""?"":c;if(w&&!w.endsWith("/")&&(w+="/"),!p.allFiles)return;for(let be of S){let Ee=w+be;if(p.allFiles.some(Y=>Y.path?.toLowerCase().startsWith(Ee.toLowerCase()+"/"))){let Y=p.allFiles.find(ut=>ut.path?.toLowerCase().startsWith(Ee.toLowerCase()+"/"))?.path;return Y?Y.substring(0,Y.indexOf("/",w.length)).substring(w.length):be}}let z=new Map;for(let be of p.allFiles){if(!be.path||w!==""&&!be.path.startsWith(w))continue;let Oe=(w===""?be.path:be.path.substring(w.length)).split("/");if(Oe.length===2){let Y=Oe[0],ut=Oe[1];z.has(Y)||z.set(Y,{docFiles:0,totalFiles:0});let Ye=z.get(Y);Ye.totalFiles++,this.isDocumentationFile(ut)&&Ye.docFiles++}}let ie,de=.5;for(let[be,Ee]of Array.from(z.entries()))if(Ee.docFiles>=2){let Oe=Ee.docFiles/Ee.totalFiles;Oe>de&&(de=Oe,ie=be)}return ie}isDocumentationFile(c){let p=c.toLowerCase();return[".md",".mdx",".rst",".txt",".adoc",".asciidoc"].some(z=>p.endsWith(z))?!0:[/^readme/i,/^changelog/i,/^changes/i,/^history/i,/^license/i,/^copying/i,/^install/i,/^usage/i,/^guide/i,/^tutorial/i,/^manual/i,/^faq/i,/^api/i,/^reference/i,/^spec/i,/^specification/i].some(z=>z.test(c))}},QFe=class{manifestFileName="pyproject.toml";packageType="python";canParse(c){return c.endsWith("pyproject.toml")||c.endsWith("setup.py")||c.endsWith("requirements.txt")}parseContent(c){try{return TFe(c)}catch{return null}}extractPackageData(c,p){let g,S=p.split("/").pop()||"";p===S?g="":g=p.substring(0,p.lastIndexOf("/"));let w=c.tool?.poetry,z=c.project,ie=w?.name||z?.name||"unnamed",de=w?.version||z?.version,be={},Ee={};if(w?.dependencies&&Object.entries(w.dependencies).forEach(([Y,ut])=>{Y!=="python"&&(be[Y]=typeof ut=="string"?ut:JSON.stringify(ut))}),w?.["dev-dependencies"]&&Object.entries(w["dev-dependencies"]).forEach(([Y,ut])=>{Ee[Y]=typeof ut=="string"?ut:JSON.stringify(ut)}),z?.dependencies&&Array.isArray(z.dependencies))try{let Y=z.dependencies.join(`
976
- `);(0,dft.parsePipRequirementsFile)(Y).forEach(Ye=>{if(Ye.type==="ProjectName"&&Ye.name){let We="*";Ye.versionSpec&&Ye.versionSpec.length>0&&(We=Ye.versionSpec[0].version||"*"),be[Ye.name]=We}})}catch(Y){console.warn("Failed to parse PEP 621 dependencies with pip-requirements-js, falling back to simple parsing:",Y),z.dependencies.forEach(ut=>{let Ye=ut.trim(),We=Ye.indexOf(" ");We>0?be[Ye.substring(0,We)]="*":be[Ye]="*"})}let Oe=this.detectPythonPackageManager(c);return{name:ie,version:de,path:g,manifestPath:p,packageManager:Oe,dependencies:be,devDependencies:Ee,peerDependencies:{},isMonorepoRoot:!1,isWorkspace:!1,parentPackage:void 0,availableCommands:[]}}detectWorkspaces(c){return null}detectPackageManager(c,p){return this.detectPythonPackageManager(c)}detectPythonPackageManager(c){return c.tool?.poetry?"poetry":"pip"}detectDocsFolder(c,p,g){return new rG().detectDocsFolder(c,p,{})}},XFe=class{manifestFileName="Cargo.toml";packageType="cargo";canParse(c){return c.endsWith("Cargo.toml")}parseContent(c){try{return TFe(c)}catch{return null}}extractPackageData(c,p){let g=c.package;if(!g)return null;let S;p==="Cargo.toml"?S="":p.endsWith("/Cargo.toml")?S=p.slice(0,-11):S=p;let w={},z={};return c.dependencies&&Object.entries(c.dependencies).forEach(([ie,de])=>{w[ie]=typeof de=="string"?de:JSON.stringify(de)}),c["dev-dependencies"]&&Object.entries(c["dev-dependencies"]).forEach(([ie,de])=>{z[ie]=typeof de=="string"?de:JSON.stringify(de)}),{name:g.name||"unnamed",version:g.version,path:S,manifestPath:p,packageManager:"cargo",dependencies:w,devDependencies:z,peerDependencies:{},isMonorepoRoot:!!c.workspace,isWorkspace:!1,parentPackage:void 0,availableCommands:[]}}detectWorkspaces(c){return c.workspace?.members||null}detectPackageManager(){return"cargo"}detectDocsFolder(c,p,g){return new rG().detectDocsFolder(c,p,{})}},JR=class{parsers=[new rG,new QFe,new XFe];async discoverPackages(c,p){let g=[];if(!c.allFiles)return g;let S=c.allFiles.filter(z=>z.path?this.parsers.some(ie=>ie.canParse(z.path)):!1),w=c.allFiles.map(z=>z.path).filter(Boolean);for(let z of S){if(!z.path)continue;let ie=this.parsers.find(_r=>_r.canParse(z.path));if(!ie)continue;let de=null;if(p)try{let _r=await p(z.path);_r&&(de=ie.parseContent(_r))}catch(_r){console.warn(`Could not read or parse ${z.path}:`,_r);continue}else{let _r=z.path.split("/").slice(-2,-1)[0]||"unnamed";de=this.createMinimalManifest(ie.packageType,_r)}if(!de)continue;let be=ie.extractPackageData(de,z.path);if(!be){console.warn(`[PackageLayerModule] extractPackageData returned null for ${z.path}`,{content:de,parser:ie.packageType});continue}let Ee=z.path.substring(0,z.path.lastIndexOf("/")),Oe=w.filter(_r=>_r.startsWith(Ee)&&this.isLockFile(_r));be.packageManager=ie.detectPackageManager(de,Oe),ie.packageType==="node"&&be.availableCommands&&be.packageManager&&be.packageManager!=="unknown"&&be.packageManager!=="npm"&&(be.availableCommands=be.availableCommands.map(_r=>{if(_r.command.includes("npm ")){let Gr=_r.command;return be.packageManager==="yarn"?Gr=Gr.replace("npm run","yarn").replace("npm install","yarn install").replace("npm ci","yarn install --frozen-lockfile").replace("npm update","yarn upgrade"):be.packageManager==="pnpm"&&(Gr=Gr.replace("npm","pnpm")),{..._r,command:Gr}}return _r}));let Y={id:`package-manifest-${be.path}`,name:ie.manifestFileName,patterns:[{type:"exact",pattern:z.path,description:`${ie.packageType} package manifest`}],matchedFiles:[z.path],fileCount:1},ut;ie.detectConfigs&&(ut=ie.detectConfigs(be.path,c,de));let Ye;ie.detectDocsFolder&&(Ye=ie.detectDocsFolder(be.path,c,de));let We=be.availableCommands?tG.calculateQualityProfile(be.availableCommands):void 0,Ut={id:`package-${ie.packageType}-${be.path.replace(/[^a-zA-Z0-9-]/g,"-")}`,name:be.name,type:ie.packageType,enabled:!0,derivedFrom:{fileSets:[Y],derivationType:"content",description:`${ie.packageType} package defined in ${ie.manifestFileName}`,contentExtraction:{method:"parse",parser:{format:ie.manifestFileName.endsWith(".json")?"json":"toml",paths:ie.packageType==="node"?[""]:ie.packageType==="python"?["tool.poetry","project"]:["package"]}}},packageData:be,configFiles:ut,docsFolder:Ye,qualityMetrics:We,pillar:"foundationHealth"};g.push(Ut)}return this.resolveWorkspaceRelationships(g),g}createPackageLayersFromBoundaries(c){return c.map(p=>{let g={id:`package-manifest-${p.rootPath||"root"}`,name:"package.json",patterns:[{type:"exact",pattern:p.packageJsonPath,description:"Node.js package manifest"}],matchedFiles:[p.packageJsonPath],fileCount:1},S={name:p.packageData?.name||p.name,version:p.packageData?.version,path:p.rootPath||".",manifestPath:p.packageJsonPath,packageManager:"unknown",dependencies:{},devDependencies:{},peerDependencies:{},isMonorepoRoot:!!p.packageData?.workspaces,isWorkspace:!p.isRoot&&c.length>1,parentPackage:p.isRoot?void 0:"root"};return{id:`package-node-${p.id}`,name:S.name,type:"node",enabled:!0,derivedFrom:{fileSets:[g],derivationType:"content",description:"Node.js package defined in package.json"},packageData:S,pillar:"foundationHealth"}})}isLockFile(c){return["package-lock.json","yarn.lock","pnpm-lock.yaml","poetry.lock","Pipfile.lock","Cargo.lock"].some(g=>c.endsWith(g))}resolveWorkspaceRelationships(c){let p=c.filter(g=>g.packageData.path==="."||g.packageData.path==="");c.forEach(g=>{if(g.packageData.path!=="."&&g.packageData.path!==""){g.packageData.isWorkspace=!0;let S=g.packageData.path.includes("/")?g.packageData.path.substring(0,g.packageData.path.lastIndexOf("/")):".",w=c.find(z=>z.packageData.path===S);w&&(g.packageData.parentPackage=w.packageData.name)}})}createMinimalManifest(c,p){switch(c){case"node":return{name:p,version:"0.0.0",dependencies:{},devDependencies:{}};case"python":return{project:{name:p,version:"0.0.0"}};case"cargo":return{package:{name:p,version:"0.0.0"}};default:return{}}}};var O1=Iy(r_t(),1);var Dur=Iy(yoe(),1);var Cur=Iy(yoe(),1);var Sur=Iy(yoe(),1);var PT=Iy(require("path")),W4=Iy(require("fs/promises")),Ike=class{constructor(c){this.basePath=c}async readFile(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return{content:await W4.readFile(p,"utf-8")}}catch(p){return console.error(`[CLIFileSystemAdapter] Failed to read ${c}:`,p),null}}async fileExists(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return await W4.access(p),!0}catch{return!1}}async readDirectory(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return await W4.readdir(p)}catch(p){return console.error(`[CLIFileSystemAdapter] Failed to read directory ${c}:`,p),[]}}async isDirectory(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return(await W4.stat(p)).isDirectory()}catch{return!1}}async buildFilteredFileTree(c,p,g){return{paths:[]}}},cG=class{constructor(){this.packageModule=new JR}async extractPackages(c,p){try{let g=new Ike(p),S=async z=>(await g.readFile(z))?.content||"",w=await this.packageModule.discoverPackages(c,S);return console.info(`[RepositoryScanner] Found ${w.length} packages in ${p}`),w}catch(g){return console.error("[RepositoryScanner] Failed to extract packages:",g),[]}}};var Kv=Iy(zke());var Wke=require("child_process"),Uke=require("stream"),Ioe=class{constructor(){this.type="node"}async execute(c,p=[],g={}){let S=Date.now();return new Promise(w=>{let z="",ie="",be={...g.env||process.env};delete be.NODE_OPTIONS,delete be.TS_NODE_PROJECT,delete be.TS_NODE_TRANSPILE_ONLY;let Ee=(0,Wke.spawn)(c,p,{cwd:g.cwd,env:be,shell:!0});Ee.stdout&&Ee.stdout.on("data",Y=>{z+=Y.toString()}),Ee.stderr&&Ee.stderr.on("data",Y=>{ie+=Y.toString()});let Oe;g.timeout&&(Oe=setTimeout(()=>{Ee.kill("SIGTERM")},g.timeout)),Ee.on("error",Y=>{Oe&&clearTimeout(Oe),w({stdout:z,stderr:ie||Y.message,exitCode:1,duration:Date.now()-S,command:c,args:p,error:Y})}),Ee.on("close",Y=>{Oe&&clearTimeout(Oe),w({stdout:z,stderr:ie,exitCode:Y??0,duration:Date.now()-S,command:c,args:p})})})}stream(c,p=[],g={}){let w={...g.env||process.env};delete w.NODE_OPTIONS,delete w.TS_NODE_PROJECT,delete w.TS_NODE_TRANSPILE_ONLY;let z=(0,Wke.spawn)(c,p,{cwd:g.cwd,env:w,shell:!0}),ie=new Promise(de=>{let be="",Ee="",Oe=Date.now();z.stdout&&z.stdout.on("data",Y=>{be+=Y.toString()}),z.stderr&&z.stderr.on("data",Y=>{Ee+=Y.toString()}),z.on("close",Y=>{de({stdout:be,stderr:Ee,exitCode:Y??0,duration:Date.now()-Oe,command:c,args:p})}),z.on("error",Y=>{de({stdout:be,stderr:Ee||Y.message,exitCode:1,duration:Date.now()-Oe,command:c,args:p,error:Y})})});return{stdout:z.stdout||new Uke.Readable({read(){}}),stderr:z.stderr||new Uke.Readable({read(){}}),exitPromise:ie,kill:()=>{z.kill("SIGTERM")}}}async isAvailable(c){try{let p=["--version"];return(await this.execute(c,p,{timeout:5e3})).exitCode===0}catch{return!1}}};var woe=class{constructor(){this.executor=new Ioe,this.lenses=new Map,this.initializeLenses()}initializeLenses(){console.log("[QualityLensService] Initializing lenses...");let c=new Kv.ESLintLens(this.executor);this.lenses.set("eslint",c),this.lenses.set("lint",c);let p=new Kv.JestLens(this.executor);this.lenses.set("jest",p),this.lenses.set("test",p);let g=new Kv.TypeScriptLens(this.executor);this.lenses.set("typescript",g),this.lenses.set("typecheck",g),this.lenses.set("tsc",g);let S=new Kv.KnipLens(this.executor);this.lenses.set("knip",S),this.lenses.set("deadcode",S);let w=new Kv.PrettierLens(this.executor);this.lenses.set("prettier",w),this.lenses.set("format",w);let z=new Kv.GitLens(this.executor);this.lenses.set("git",z);let ie=new Kv.AlexandriaLens(this.executor);this.lenses.set("alexandria",ie),this.lenses.set("docs",ie)}async executeTool(c){let p=Date.now();if(!c.packageLayer||!c.packageCommand)throw new Error("packageLayer and packageCommand are required. Legacy execution has been removed.");return this.executeWithPackageLayer(c,p)}async executeWithPackageLayer(c,p){let{repoPath:g,packageLayer:S,packageCommand:w}=c;if(!S||!w)throw new Error("packageLayer and packageCommand are required for new execution path");let z=S.packageData.path||"",ie=z?`${g}/${z}`:g;if(!w.isLensCommand||!w.lensId)return console.log(`[QualityLensService] Not a lens command, executing directly: ${w.name}`),this.executeNonLensCommand(c,w,ie,p);let de=this.lenses.get(w.lensId);if(!de)return console.warn(`[QualityLensService] No lens registered for: ${w.lensId}`),this.executeNonLensCommand(c,w,ie,p);console.log(`[QualityLensService] Using ${de.name} for command: ${w.name} (lensId: ${w.lensId})`);try{let{command:be,args:Ee}=this.parseCommandString(w.command);de.configure({cwd:ie,tool:{name:w.lensId,command:be,args:Ee,cwd:ie,available:!0}});let Oe=await de.run(),{success:Y,exitCode:ut}=this.determineLensSuccess(Oe);return{success:Y,toolName:w.lensId,command:w.command,packagePath:z,exitCode:ut,duration:Date.now()-p,stdout:Oe.raw?.stdout||"",stderr:Oe.raw?.stderr||Oe.error?.message||"",lensResult:Oe,qualityContext:{lensId:w.lensId,operation:w.lensOperation,availableLenses:S.qualityMetrics?.availableLenses,missingLenses:S.qualityMetrics?.missingLenses}}}catch(be){return console.error("[QualityLensService] Error:",be),this.createErrorResponse(w.lensId||w.name,w.command,z,be,p)}}async executeNonLensCommand(c,p,g,S){let{command:w,args:z}=this.parseCommandString(p.command);try{let ie=await this.executor.execute(w,z,{cwd:g});return{success:ie.exitCode===0,toolName:p.name,command:p.command,packagePath:c.packageLayer?.packageData.path,exitCode:ie.exitCode,duration:Date.now()-S,stdout:ie.stdout,stderr:ie.stderr}}catch(ie){return this.createErrorResponse(p.name,p.command,c.packageLayer?.packageData.path,ie,S)}}parseCommandString(c){if(c.startsWith("npm run "))return{command:"npm",args:["run",...c.split(" ").slice(2)]};if(c.startsWith("yarn "))return{command:"yarn",args:c.split(" ").slice(1)};if(c.startsWith("pnpm "))return{command:"pnpm",args:c.split(" ").slice(1)};let p=c.split(" ");return{command:p[0]||"",args:p.slice(1)}}determineLensSuccess(c){let p=0;return c.raw?.exitCode!==void 0?p=c.raw.exitCode:(c.error||c.metrics?.issuesBySeverity?.error&&c.metrics.issuesBySeverity.error>0)&&(p=1),{success:p!==127,exitCode:p}}createErrorResponse(c,p,g,S,w){return{success:!1,toolName:c,command:p,packagePath:g,exitCode:1,duration:Date.now()-w,stdout:"",stderr:S.message||"Tool execution failed",error:S.message}}getAvailableLenses(){return Array.from(this.lenses.keys())}hasLensForTool(c){return this.lenses.has(c.toLowerCase())}};var Poe=class{mapLensToHexagonDimension(c){return{jest:"tests",test:"tests",knip:"deadCode",deadcode:"deadCode",prettier:"formatting",format:"formatting",eslint:"linting",lint:"linting",typescript:"types",typecheck:"types",tsc:"types",alexandria:"documentation"}[c.toLowerCase()]||null}extractQualityScore(c){if(c.result?.lensResult?.qualityScore!==void 0&&c.result.lensResult.qualityScore!==null)return c.result.lensResult.qualityScore;let p=c.result?.lensResult?.metrics;if(p){if(!c.result?.success)return 0;let g=p.totalIssues||0,S=p.filesAnalyzed||1;if(g===0)return 100;let w=p.issuesBySeverity||{},z=(w.error||0)*3,ie=(w.warning||0)*2,de=(w.info||0)*1,be=(w.hint||0)*.5,Oe=(z+ie+de+be)/S,Y=Math.max(0,100-Oe*10);return Math.round(Y)}return 0}calculateHexagonMetrics(c){let p={tests:0,deadCode:0,formatting:0,linting:0,types:0,documentation:0};for(let g of c){let S=this.mapLensToHexagonDimension(g.lens);if(S){let w=this.extractQualityScore(g);p[S]=Math.max(p[S],w)}}return p}getGitMetadata(){let c={};if(process.env.GITHUB_SHA&&(c.commit=process.env.GITHUB_SHA),process.env.GITHUB_REF){let p=process.env.GITHUB_REF;p.startsWith("refs/heads/")?c.branch=p.replace("refs/heads/",""):p.startsWith("refs/pull/")&&(c.branch=p)}if(process.env.GITHUB_REPOSITORY&&(c.repository=process.env.GITHUB_REPOSITORY),Object.keys(c).length!==0)return c}format(c){let p=this.getGitMetadata(),g={metadata:{timestamp:new Date().toISOString(),version:"1.0.0",totalPackages:new Set(c.map(S=>S.package)).size,totalLenses:c.length,...p&&{git:p}},results:c.map(S=>({package:{name:S.package,path:S.packagePath},lens:{id:S.lens,command:S.command},execution:{success:S.result?.success??!1,exitCode:S.result?.exitCode,duration:S.result?.duration,timestamp:S.timestamp},issues:S.result?.lensResult?.issues||[],metrics:S.result?.lensResult?.metrics||{},coverage:S.result?.lensResult?.coverage,fileMetrics:S.result?.lensResult?.fileMetrics,qualityContext:S.result?.qualityContext||{},error:S.error}))};return c.length>0&&(g.qualityMetrics={hexagon:this.calculateHexagonMetrics(c)}),JSON.stringify(g,null,2)}};var M_t=(_=0)=>c=>`\x1B[${c+_}m`,B_t=(_=0)=>c=>`\x1B[${38+_};5;${c}m`,j_t=(_=0)=>(c,p,g)=>`\x1B[${38+_};2;${c};${p};${g}m`,Zp={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},QIr=Object.keys(Zp.modifier),alr=Object.keys(Zp.color),olr=Object.keys(Zp.bgColor),XIr=[...alr,...olr];function clr(){let _=new Map;for(let[c,p]of Object.entries(Zp)){for(let[g,S]of Object.entries(p))Zp[g]={open:`\x1B[${S[0]}m`,close:`\x1B[${S[1]}m`},p[g]=Zp[g],_.set(S[0],S[1]);Object.defineProperty(Zp,c,{value:p,enumerable:!1})}return Object.defineProperty(Zp,"codes",{value:_,enumerable:!1}),Zp.color.close="\x1B[39m",Zp.bgColor.close="\x1B[49m",Zp.color.ansi=M_t(),Zp.color.ansi256=B_t(),Zp.color.ansi16m=j_t(),Zp.bgColor.ansi=M_t(10),Zp.bgColor.ansi256=B_t(10),Zp.bgColor.ansi16m=j_t(10),Object.defineProperties(Zp,{rgbToAnsi256:{value(c,p,g){return c===p&&p===g?c<8?16:c>248?231:Math.round((c-8)/247*24)+232:16+36*Math.round(c/255*5)+6*Math.round(p/255*5)+Math.round(g/255*5)},enumerable:!1},hexToRgb:{value(c){let p=/[a-f\d]{6}|[a-f\d]{3}/i.exec(c.toString(16));if(!p)return[0,0,0];let[g]=p;g.length===3&&(g=[...g].map(w=>w+w).join(""));let S=Number.parseInt(g,16);return[S>>16&255,S>>8&255,S&255]},enumerable:!1},hexToAnsi256:{value:c=>Zp.rgbToAnsi256(...Zp.hexToRgb(c)),enumerable:!1},ansi256ToAnsi:{value(c){if(c<8)return 30+c;if(c<16)return 90+(c-8);let p,g,S;if(c>=232)p=((c-232)*10+8)/255,g=p,S=p;else{c-=16;let ie=c%36;p=Math.floor(c/36)/5,g=Math.floor(ie/6)/5,S=ie%6/5}let w=Math.max(p,g,S)*2;if(w===0)return 30;let z=30+(Math.round(S)<<2|Math.round(g)<<1|Math.round(p));return w===2&&(z+=60),z},enumerable:!1},rgbToAnsi:{value:(c,p,g)=>Zp.ansi256ToAnsi(Zp.rgbToAnsi256(c,p,g)),enumerable:!1},hexToAnsi:{value:c=>Zp.ansi256ToAnsi(Zp.hexToAnsi256(c)),enumerable:!1}}),Zp}var ulr=clr(),lE=ulr;var Ooe=Iy(require("node:process"),1),q_t=Iy(require("node:os"),1),Vke=Iy(require("node:tty"),1);function CC(_,c=globalThis.Deno?globalThis.Deno.args:Ooe.default.argv){let p=_.startsWith("-")?"":_.length===1?"-":"--",g=c.indexOf(p+_),S=c.indexOf("--");return g!==-1&&(S===-1||g<S)}var{env:ed}=Ooe.default,Noe;CC("no-color")||CC("no-colors")||CC("color=false")||CC("color=never")?Noe=0:(CC("color")||CC("colors")||CC("color=true")||CC("color=always"))&&(Noe=1);function llr(){if("FORCE_COLOR"in ed)return ed.FORCE_COLOR==="true"?1:ed.FORCE_COLOR==="false"?0:ed.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ed.FORCE_COLOR,10),3)}function flr(_){return _===0?!1:{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function _lr(_,{streamIsTTY:c,sniffFlags:p=!0}={}){let g=llr();g!==void 0&&(Noe=g);let S=p?Noe:g;if(S===0)return 0;if(p){if(CC("color=16m")||CC("color=full")||CC("color=truecolor"))return 3;if(CC("color=256"))return 2}if("TF_BUILD"in ed&&"AGENT_NAME"in ed)return 1;if(_&&!c&&S===void 0)return 0;let w=S||0;if(ed.TERM==="dumb")return w;if(Ooe.default.platform==="win32"){let z=q_t.default.release().split(".");return Number(z[0])>=10&&Number(z[2])>=10586?Number(z[2])>=14931?3:2:1}if("CI"in ed)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(z=>z in ed)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(z=>z in ed)||ed.CI_NAME==="codeship"?1:w;if("TEAMCITY_VERSION"in ed)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ed.TEAMCITY_VERSION)?1:0;if(ed.COLORTERM==="truecolor"||ed.TERM==="xterm-kitty"||ed.TERM==="xterm-ghostty"||ed.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ed){let z=Number.parseInt((ed.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ed.TERM_PROGRAM){case"iTerm.app":return z>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ed.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ed.TERM)||"COLORTERM"in ed?1:w}function J_t(_,c={}){let p=_lr(_,{streamIsTTY:_&&_.isTTY,...c});return flr(p)}var plr={stdout:J_t({isTTY:Vke.default.isatty(1)}),stderr:J_t({isTTY:Vke.default.isatty(2)})},z_t=plr;function W_t(_,c,p){let g=_.indexOf(c);if(g===-1)return _;let S=c.length,w=0,z="";do z+=_.slice(w,g)+c+p,w=g+S,g=_.indexOf(c,w);while(g!==-1);return z+=_.slice(w),z}function U_t(_,c,p,g){let S=0,w="";do{let z=_[g-1]==="\r";w+=_.slice(S,z?g-1:g)+c+(z?`\r
976
+ `);(0,dft.parsePipRequirementsFile)(Y).forEach(Ye=>{if(Ye.type==="ProjectName"&&Ye.name){let We="*";Ye.versionSpec&&Ye.versionSpec.length>0&&(We=Ye.versionSpec[0].version||"*"),be[Ye.name]=We}})}catch(Y){console.warn("Failed to parse PEP 621 dependencies with pip-requirements-js, falling back to simple parsing:",Y),z.dependencies.forEach(ut=>{let Ye=ut.trim(),We=Ye.indexOf(" ");We>0?be[Ye.substring(0,We)]="*":be[Ye]="*"})}let Oe=this.detectPythonPackageManager(c);return{name:ie,version:de,path:g,manifestPath:p,packageManager:Oe,dependencies:be,devDependencies:Ee,peerDependencies:{},isMonorepoRoot:!1,isWorkspace:!1,parentPackage:void 0,availableCommands:[]}}detectWorkspaces(c){return null}detectPackageManager(c,p){return this.detectPythonPackageManager(c)}detectPythonPackageManager(c){return c.tool?.poetry?"poetry":"pip"}detectDocsFolder(c,p,g){return new rG().detectDocsFolder(c,p,{})}},XFe=class{manifestFileName="Cargo.toml";packageType="cargo";canParse(c){return c.endsWith("Cargo.toml")}parseContent(c){try{return TFe(c)}catch{return null}}extractPackageData(c,p){let g=c.package;if(!g)return null;let S;p==="Cargo.toml"?S="":p.endsWith("/Cargo.toml")?S=p.slice(0,-11):S=p;let w={},z={};return c.dependencies&&Object.entries(c.dependencies).forEach(([ie,de])=>{w[ie]=typeof de=="string"?de:JSON.stringify(de)}),c["dev-dependencies"]&&Object.entries(c["dev-dependencies"]).forEach(([ie,de])=>{z[ie]=typeof de=="string"?de:JSON.stringify(de)}),{name:g.name||"unnamed",version:g.version,path:S,manifestPath:p,packageManager:"cargo",dependencies:w,devDependencies:z,peerDependencies:{},isMonorepoRoot:!!c.workspace,isWorkspace:!1,parentPackage:void 0,availableCommands:[]}}detectWorkspaces(c){return c.workspace?.members||null}detectPackageManager(){return"cargo"}detectDocsFolder(c,p,g){return new rG().detectDocsFolder(c,p,{})}},JR=class{parsers=[new rG,new QFe,new XFe];async discoverPackages(c,p){let g=[];if(!c.allFiles)return g;let S=c.allFiles.filter(z=>z.path?this.parsers.some(ie=>ie.canParse(z.path)):!1),w=c.allFiles.map(z=>z.path).filter(Boolean);for(let z of S){if(!z.path)continue;let ie=this.parsers.find(_r=>_r.canParse(z.path));if(!ie)continue;let de=null;if(p)try{let _r=await p(z.path);_r&&(de=ie.parseContent(_r))}catch(_r){console.warn(`Could not read or parse ${z.path}:`,_r);continue}else{let _r=z.path.split("/").slice(-2,-1)[0]||"unnamed";de=this.createMinimalManifest(ie.packageType,_r)}if(!de)continue;let be=ie.extractPackageData(de,z.path);if(!be){console.warn(`[PackageLayerModule] extractPackageData returned null for ${z.path}`,{content:de,parser:ie.packageType});continue}let Ee=z.path.substring(0,z.path.lastIndexOf("/")),Oe=w.filter(_r=>_r.startsWith(Ee)&&this.isLockFile(_r));be.packageManager=ie.detectPackageManager(de,Oe),ie.packageType==="node"&&be.availableCommands&&be.packageManager&&be.packageManager!=="unknown"&&be.packageManager!=="npm"&&(be.availableCommands=be.availableCommands.map(_r=>{if(_r.command.includes("npm ")){let Gr=_r.command;return be.packageManager==="yarn"?Gr=Gr.replace("npm run","yarn").replace("npm install","yarn install").replace("npm ci","yarn install --frozen-lockfile").replace("npm update","yarn upgrade"):be.packageManager==="pnpm"&&(Gr=Gr.replace("npm","pnpm")),{..._r,command:Gr}}return _r}));let Y={id:`package-manifest-${be.path}`,name:ie.manifestFileName,patterns:[{type:"exact",pattern:z.path,description:`${ie.packageType} package manifest`}],matchedFiles:[z.path],fileCount:1},ut;ie.detectConfigs&&(ut=ie.detectConfigs(be.path,c,de));let Ye;ie.detectDocsFolder&&(Ye=ie.detectDocsFolder(be.path,c,de));let We=be.availableCommands?tG.calculateQualityProfile(be.availableCommands):void 0,Ut={id:`package-${ie.packageType}-${be.path.replace(/[^a-zA-Z0-9-]/g,"-")}`,name:be.name,type:ie.packageType,enabled:!0,derivedFrom:{fileSets:[Y],derivationType:"content",description:`${ie.packageType} package defined in ${ie.manifestFileName}`,contentExtraction:{method:"parse",parser:{format:ie.manifestFileName.endsWith(".json")?"json":"toml",paths:ie.packageType==="node"?[""]:ie.packageType==="python"?["tool.poetry","project"]:["package"]}}},packageData:be,configFiles:ut,docsFolder:Ye,qualityMetrics:We,pillar:"foundationHealth"};g.push(Ut)}return this.resolveWorkspaceRelationships(g),g}createPackageLayersFromBoundaries(c){return c.map(p=>{let g={id:`package-manifest-${p.rootPath||"root"}`,name:"package.json",patterns:[{type:"exact",pattern:p.packageJsonPath,description:"Node.js package manifest"}],matchedFiles:[p.packageJsonPath],fileCount:1},S={name:p.packageData?.name||p.name,version:p.packageData?.version,path:p.rootPath||".",manifestPath:p.packageJsonPath,packageManager:"unknown",dependencies:{},devDependencies:{},peerDependencies:{},isMonorepoRoot:!!p.packageData?.workspaces,isWorkspace:!p.isRoot&&c.length>1,parentPackage:p.isRoot?void 0:"root"};return{id:`package-node-${p.id}`,name:S.name,type:"node",enabled:!0,derivedFrom:{fileSets:[g],derivationType:"content",description:"Node.js package defined in package.json"},packageData:S,pillar:"foundationHealth"}})}isLockFile(c){return["package-lock.json","yarn.lock","pnpm-lock.yaml","poetry.lock","Pipfile.lock","Cargo.lock"].some(g=>c.endsWith(g))}resolveWorkspaceRelationships(c){let p=c.filter(g=>g.packageData.path==="."||g.packageData.path==="");c.forEach(g=>{if(g.packageData.path!=="."&&g.packageData.path!==""){g.packageData.isWorkspace=!0;let S=g.packageData.path.includes("/")?g.packageData.path.substring(0,g.packageData.path.lastIndexOf("/")):".",w=c.find(z=>z.packageData.path===S);w&&(g.packageData.parentPackage=w.packageData.name)}})}createMinimalManifest(c,p){switch(c){case"node":return{name:p,version:"0.0.0",dependencies:{},devDependencies:{}};case"python":return{project:{name:p,version:"0.0.0"}};case"cargo":return{package:{name:p,version:"0.0.0"}};default:return{}}}};var O1=Iy(r_t(),1);var Dur=Iy(yoe(),1);var Cur=Iy(yoe(),1);var Sur=Iy(yoe(),1);var PT=Iy(require("path")),W4=Iy(require("fs/promises")),Ike=class{constructor(c){this.basePath=c}async readFile(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return{content:await W4.readFile(p,"utf-8")}}catch(p){return console.error(`[CLIFileSystemAdapter] Failed to read ${c}:`,p),null}}async fileExists(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return await W4.access(p),!0}catch{return!1}}async readDirectory(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return await W4.readdir(p)}catch(p){return console.error(`[CLIFileSystemAdapter] Failed to read directory ${c}:`,p),[]}}async isDirectory(c){try{let p=PT.isAbsolute(c)?c:PT.join(this.basePath,c);return(await W4.stat(p)).isDirectory()}catch{return!1}}async buildFilteredFileTree(c,p,g){return{paths:[]}}},cG=class{constructor(){this.packageModule=new JR}async extractPackages(c,p){try{let g=new Ike(p),S=async z=>(await g.readFile(z))?.content||"",w=await this.packageModule.discoverPackages(c,S);return console.info(`[RepositoryScanner] Found ${w.length} packages in ${p}`),w}catch(g){return console.error("[RepositoryScanner] Failed to extract packages:",g),[]}}};var Kv=Iy(zke());var Wke=require("child_process"),Uke=require("stream"),Ioe=class{constructor(){this.type="node"}async execute(c,p=[],g={}){let S=Date.now();return new Promise(w=>{let z="",ie="",be={...g.env||process.env};delete be.NODE_OPTIONS,delete be.TS_NODE_PROJECT,delete be.TS_NODE_TRANSPILE_ONLY;let Ee=(0,Wke.spawn)(c,p,{cwd:g.cwd,env:be,shell:!0});Ee.stdout&&Ee.stdout.on("data",Y=>{z+=Y.toString()}),Ee.stderr&&Ee.stderr.on("data",Y=>{ie+=Y.toString()});let Oe;g.timeout&&(Oe=setTimeout(()=>{Ee.kill("SIGTERM")},g.timeout)),Ee.on("error",Y=>{Oe&&clearTimeout(Oe),w({stdout:z,stderr:ie||Y.message,exitCode:1,duration:Date.now()-S,command:c,args:p,error:Y})}),Ee.on("close",Y=>{Oe&&clearTimeout(Oe),w({stdout:z,stderr:ie,exitCode:Y??0,duration:Date.now()-S,command:c,args:p})})})}stream(c,p=[],g={}){let w={...g.env||process.env};delete w.NODE_OPTIONS,delete w.TS_NODE_PROJECT,delete w.TS_NODE_TRANSPILE_ONLY;let z=(0,Wke.spawn)(c,p,{cwd:g.cwd,env:w,shell:!0}),ie=new Promise(de=>{let be="",Ee="",Oe=Date.now();z.stdout&&z.stdout.on("data",Y=>{be+=Y.toString()}),z.stderr&&z.stderr.on("data",Y=>{Ee+=Y.toString()}),z.on("close",Y=>{de({stdout:be,stderr:Ee,exitCode:Y??0,duration:Date.now()-Oe,command:c,args:p})}),z.on("error",Y=>{de({stdout:be,stderr:Ee||Y.message,exitCode:1,duration:Date.now()-Oe,command:c,args:p,error:Y})})});return{stdout:z.stdout||new Uke.Readable({read(){}}),stderr:z.stderr||new Uke.Readable({read(){}}),exitPromise:ie,kill:()=>{z.kill("SIGTERM")}}}async isAvailable(c){try{let p=["--version"];return(await this.execute(c,p,{timeout:5e3})).exitCode===0}catch{return!1}}};var woe=class{constructor(){this.executor=new Ioe,this.lenses=new Map,this.initializeLenses()}initializeLenses(){console.log("[QualityLensService] Initializing lenses...");let c=new Kv.ESLintLens(this.executor);this.lenses.set("eslint",c),this.lenses.set("lint",c);let p=new Kv.JestLens(this.executor);this.lenses.set("jest",p),this.lenses.set("test",p);let g=new Kv.TypeScriptLens(this.executor);this.lenses.set("typescript",g),this.lenses.set("typecheck",g),this.lenses.set("tsc",g);let S=new Kv.KnipLens(this.executor);this.lenses.set("knip",S),this.lenses.set("deadcode",S);let w=new Kv.PrettierLens(this.executor);this.lenses.set("prettier",w),this.lenses.set("format",w);let z=new Kv.GitLens(this.executor);this.lenses.set("git",z);let ie=new Kv.AlexandriaLens(this.executor);this.lenses.set("alexandria",ie),this.lenses.set("docs",ie)}async executeTool(c){let p=Date.now();if(!c.packageLayer||!c.packageCommand)throw new Error("packageLayer and packageCommand are required. Legacy execution has been removed.");return this.executeWithPackageLayer(c,p)}async executeWithPackageLayer(c,p){let{repoPath:g,packageLayer:S,packageCommand:w}=c;if(!S||!w)throw new Error("packageLayer and packageCommand are required for new execution path");let z=S.packageData.path||"",ie=z?`${g}/${z}`:g;if(!w.isLensCommand||!w.lensId)return console.log(`[QualityLensService] Not a lens command, executing directly: ${w.name}`),this.executeNonLensCommand(c,w,ie,p);let de=this.lenses.get(w.lensId);if(!de)return console.warn(`[QualityLensService] No lens registered for: ${w.lensId}`),this.executeNonLensCommand(c,w,ie,p);console.log(`[QualityLensService] Using ${de.name} for command: ${w.name} (lensId: ${w.lensId})`);try{let{command:be,args:Ee}=this.parseCommandString(w.command);de.configure({cwd:ie,tool:{name:w.lensId,command:be,args:Ee,cwd:ie,available:!0}});let Oe=await de.run(),{success:Y,exitCode:ut}=this.determineLensSuccess(Oe);return{success:Y,toolName:w.lensId,command:w.command,packagePath:z,exitCode:ut,duration:Date.now()-p,stdout:Oe.raw?.stdout||"",stderr:Oe.raw?.stderr||Oe.error?.message||"",lensResult:Oe,qualityContext:{lensId:w.lensId,operation:w.lensOperation,availableLenses:S.qualityMetrics?.availableLenses,missingLenses:S.qualityMetrics?.missingLenses}}}catch(be){return console.error("[QualityLensService] Error:",be),this.createErrorResponse(w.lensId||w.name,w.command,z,be,p)}}async executeNonLensCommand(c,p,g,S){let{command:w,args:z}=this.parseCommandString(p.command);try{let ie=await this.executor.execute(w,z,{cwd:g});return{success:ie.exitCode===0,toolName:p.name,command:p.command,packagePath:c.packageLayer?.packageData.path,exitCode:ie.exitCode,duration:Date.now()-S,stdout:ie.stdout,stderr:ie.stderr}}catch(ie){return this.createErrorResponse(p.name,p.command,c.packageLayer?.packageData.path,ie,S)}}parseCommandString(c){if(c.startsWith("npm run "))return{command:"npm",args:["run",...c.split(" ").slice(2)]};if(c.startsWith("yarn "))return{command:"yarn",args:c.split(" ").slice(1)};if(c.startsWith("pnpm "))return{command:"pnpm",args:c.split(" ").slice(1)};let p=c.split(" ");return{command:p[0]||"",args:p.slice(1)}}determineLensSuccess(c){let p=0;return c.raw?.exitCode!==void 0?p=c.raw.exitCode:(c.error||c.metrics?.issuesBySeverity?.error&&c.metrics.issuesBySeverity.error>0)&&(p=1),{success:p!==127,exitCode:p}}createErrorResponse(c,p,g,S,w){return{success:!1,toolName:c,command:p,packagePath:g,exitCode:1,duration:Date.now()-w,stdout:"",stderr:S.message||"Tool execution failed",error:S.message}}getAvailableLenses(){return Array.from(this.lenses.keys())}hasLensForTool(c){return this.lenses.has(c.toLowerCase())}};var Poe=class{mapLensToHexagonDimension(c){return{jest:"tests",test:"tests",knip:"deadCode",deadcode:"deadCode",prettier:"formatting",format:"formatting",eslint:"linting",lint:"linting",typescript:"types",typecheck:"types",tsc:"types",alexandria:"documentation"}[c.toLowerCase()]||null}extractQualityScore(c){if(c.result?.lensResult?.qualityScore!==void 0&&c.result.lensResult.qualityScore!==null&&c.result.lensResult.qualityScore>0)return c.result.lensResult.qualityScore;let p=c.result?.lensResult?.metrics;if(p){if(!c.result?.success)return 0;let g=p.totalIssues||0,S=p.filesAnalyzed||1;if(g===0)return 100;let w=p.issuesBySeverity||{},z=(w.error||0)*3,ie=(w.warning||0)*2,de=(w.info||0)*1,be=(w.hint||0)*.5,Oe=(z+ie+de+be)/S,Y=Math.max(0,100-Oe*10);return Math.round(Y)}return 0}calculateHexagonMetrics(c){let p={tests:0,deadCode:0,formatting:0,linting:0,types:0,documentation:0};for(let g of c){let S=this.mapLensToHexagonDimension(g.lens);if(S){let w=this.extractQualityScore(g);p[S]=Math.max(p[S],w)}}return p}getGitMetadata(){let c={};if(process.env.GITHUB_SHA&&(c.commit=process.env.GITHUB_SHA),process.env.GITHUB_REF){let p=process.env.GITHUB_REF;p.startsWith("refs/heads/")?c.branch=p.replace("refs/heads/",""):p.startsWith("refs/pull/")&&(c.branch=p)}if(process.env.GITHUB_REPOSITORY&&(c.repository=process.env.GITHUB_REPOSITORY),Object.keys(c).length!==0)return c}format(c){let p=this.getGitMetadata(),g={metadata:{timestamp:new Date().toISOString(),version:"1.0.0",totalPackages:new Set(c.map(S=>S.package)).size,totalLenses:c.length,...p&&{git:p}},results:c.map(S=>({package:{name:S.package,path:S.packagePath},lens:{id:S.lens,command:S.command},execution:{success:S.result?.success??!1,exitCode:S.result?.exitCode,duration:S.result?.duration,timestamp:S.timestamp},issues:S.result?.lensResult?.issues||[],metrics:S.result?.lensResult?.metrics||{},coverage:S.result?.lensResult?.coverage,fileMetrics:S.result?.lensResult?.fileMetrics,qualityContext:S.result?.qualityContext||{},error:S.error}))};return c.length>0&&(g.qualityMetrics={hexagon:this.calculateHexagonMetrics(c)}),JSON.stringify(g,null,2)}};var M_t=(_=0)=>c=>`\x1B[${c+_}m`,B_t=(_=0)=>c=>`\x1B[${38+_};5;${c}m`,j_t=(_=0)=>(c,p,g)=>`\x1B[${38+_};2;${c};${p};${g}m`,Zp={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},QIr=Object.keys(Zp.modifier),alr=Object.keys(Zp.color),olr=Object.keys(Zp.bgColor),XIr=[...alr,...olr];function clr(){let _=new Map;for(let[c,p]of Object.entries(Zp)){for(let[g,S]of Object.entries(p))Zp[g]={open:`\x1B[${S[0]}m`,close:`\x1B[${S[1]}m`},p[g]=Zp[g],_.set(S[0],S[1]);Object.defineProperty(Zp,c,{value:p,enumerable:!1})}return Object.defineProperty(Zp,"codes",{value:_,enumerable:!1}),Zp.color.close="\x1B[39m",Zp.bgColor.close="\x1B[49m",Zp.color.ansi=M_t(),Zp.color.ansi256=B_t(),Zp.color.ansi16m=j_t(),Zp.bgColor.ansi=M_t(10),Zp.bgColor.ansi256=B_t(10),Zp.bgColor.ansi16m=j_t(10),Object.defineProperties(Zp,{rgbToAnsi256:{value(c,p,g){return c===p&&p===g?c<8?16:c>248?231:Math.round((c-8)/247*24)+232:16+36*Math.round(c/255*5)+6*Math.round(p/255*5)+Math.round(g/255*5)},enumerable:!1},hexToRgb:{value(c){let p=/[a-f\d]{6}|[a-f\d]{3}/i.exec(c.toString(16));if(!p)return[0,0,0];let[g]=p;g.length===3&&(g=[...g].map(w=>w+w).join(""));let S=Number.parseInt(g,16);return[S>>16&255,S>>8&255,S&255]},enumerable:!1},hexToAnsi256:{value:c=>Zp.rgbToAnsi256(...Zp.hexToRgb(c)),enumerable:!1},ansi256ToAnsi:{value(c){if(c<8)return 30+c;if(c<16)return 90+(c-8);let p,g,S;if(c>=232)p=((c-232)*10+8)/255,g=p,S=p;else{c-=16;let ie=c%36;p=Math.floor(c/36)/5,g=Math.floor(ie/6)/5,S=ie%6/5}let w=Math.max(p,g,S)*2;if(w===0)return 30;let z=30+(Math.round(S)<<2|Math.round(g)<<1|Math.round(p));return w===2&&(z+=60),z},enumerable:!1},rgbToAnsi:{value:(c,p,g)=>Zp.ansi256ToAnsi(Zp.rgbToAnsi256(c,p,g)),enumerable:!1},hexToAnsi:{value:c=>Zp.ansi256ToAnsi(Zp.hexToAnsi256(c)),enumerable:!1}}),Zp}var ulr=clr(),lE=ulr;var Ooe=Iy(require("node:process"),1),q_t=Iy(require("node:os"),1),Vke=Iy(require("node:tty"),1);function CC(_,c=globalThis.Deno?globalThis.Deno.args:Ooe.default.argv){let p=_.startsWith("-")?"":_.length===1?"-":"--",g=c.indexOf(p+_),S=c.indexOf("--");return g!==-1&&(S===-1||g<S)}var{env:ed}=Ooe.default,Noe;CC("no-color")||CC("no-colors")||CC("color=false")||CC("color=never")?Noe=0:(CC("color")||CC("colors")||CC("color=true")||CC("color=always"))&&(Noe=1);function llr(){if("FORCE_COLOR"in ed)return ed.FORCE_COLOR==="true"?1:ed.FORCE_COLOR==="false"?0:ed.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ed.FORCE_COLOR,10),3)}function flr(_){return _===0?!1:{level:_,hasBasic:!0,has256:_>=2,has16m:_>=3}}function _lr(_,{streamIsTTY:c,sniffFlags:p=!0}={}){let g=llr();g!==void 0&&(Noe=g);let S=p?Noe:g;if(S===0)return 0;if(p){if(CC("color=16m")||CC("color=full")||CC("color=truecolor"))return 3;if(CC("color=256"))return 2}if("TF_BUILD"in ed&&"AGENT_NAME"in ed)return 1;if(_&&!c&&S===void 0)return 0;let w=S||0;if(ed.TERM==="dumb")return w;if(Ooe.default.platform==="win32"){let z=q_t.default.release().split(".");return Number(z[0])>=10&&Number(z[2])>=10586?Number(z[2])>=14931?3:2:1}if("CI"in ed)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(z=>z in ed)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(z=>z in ed)||ed.CI_NAME==="codeship"?1:w;if("TEAMCITY_VERSION"in ed)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ed.TEAMCITY_VERSION)?1:0;if(ed.COLORTERM==="truecolor"||ed.TERM==="xterm-kitty"||ed.TERM==="xterm-ghostty"||ed.TERM==="wezterm")return 3;if("TERM_PROGRAM"in ed){let z=Number.parseInt((ed.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ed.TERM_PROGRAM){case"iTerm.app":return z>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(ed.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ed.TERM)||"COLORTERM"in ed?1:w}function J_t(_,c={}){let p=_lr(_,{streamIsTTY:_&&_.isTTY,...c});return flr(p)}var plr={stdout:J_t({isTTY:Vke.default.isatty(1)}),stderr:J_t({isTTY:Vke.default.isatty(2)})},z_t=plr;function W_t(_,c,p){let g=_.indexOf(c);if(g===-1)return _;let S=c.length,w=0,z="";do z+=_.slice(w,g)+c+p,w=g+S,g=_.indexOf(c,w);while(g!==-1);return z+=_.slice(w),z}function U_t(_,c,p,g){let S=0,w="";do{let z=_[g-1]==="\r";w+=_.slice(S,z?g-1:g)+c+(z?`\r
977
977
  `:`
978
978
  `)+p,S=g+1,g=_.indexOf(`
979
979
  `,S)}while(g!==-1);return w+=_.slice(S),w}var{stdout:V_t,stderr:G_t}=z_t,Gke=Symbol("GENERATOR"),KR=Symbol("STYLER"),lG=Symbol("IS_EMPTY"),$_t=["ansi","ansi","ansi256","ansi16m"],QR=Object.create(null),dlr=(_,c={})=>{if(c.level&&!(Number.isInteger(c.level)&&c.level>=0&&c.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let p=V_t?V_t.level:0;_.level=c.level===void 0?p:c.level};var mlr=_=>{let c=(...p)=>p.join(" ");return dlr(c,_),Object.setPrototypeOf(c,fG.prototype),c};function fG(_){return mlr(_)}Object.setPrototypeOf(fG.prototype,Function.prototype);for(let[_,c]of Object.entries(lE))QR[_]={get(){let p=Loe(this,Hke(c.open,c.close,this[KR]),this[lG]);return Object.defineProperty(this,_,{value:p}),p}};QR.visible={get(){let _=Loe(this,this[KR],!0);return Object.defineProperty(this,"visible",{value:_}),_}};var $ke=(_,c,p,...g)=>_==="rgb"?c==="ansi16m"?lE[p].ansi16m(...g):c==="ansi256"?lE[p].ansi256(lE.rgbToAnsi256(...g)):lE[p].ansi(lE.rgbToAnsi(...g)):_==="hex"?$ke("rgb",c,p,...lE.hexToRgb(...g)):lE[p][_](...g),hlr=["rgb","hex","ansi256"];for(let _ of hlr){QR[_]={get(){let{level:p}=this;return function(...g){let S=Hke($ke(_,$_t[p],"color",...g),lE.color.close,this[KR]);return Loe(this,S,this[lG])}}};let c="bg"+_[0].toUpperCase()+_.slice(1);QR[c]={get(){let{level:p}=this;return function(...g){let S=Hke($ke(_,$_t[p],"bgColor",...g),lE.bgColor.close,this[KR]);return Loe(this,S,this[lG])}}}}var glr=Object.defineProperties(()=>{},{...QR,level:{enumerable:!0,get(){return this[Gke].level},set(_){this[Gke].level=_}}}),Hke=(_,c,p)=>{let g,S;return p===void 0?(g=_,S=c):(g=p.openAll+_,S=c+p.closeAll),{open:_,close:c,openAll:g,closeAll:S,parent:p}},Loe=(_,c,p)=>{let g=(...S)=>ylr(g,S.length===1?""+S[0]:S.join(" "));return Object.setPrototypeOf(g,glr),g[Gke]=_,g[KR]=c,g[lG]=p,g},ylr=(_,c)=>{if(_.level<=0||!c)return _[lG]?"":c;let p=_[KR];if(p===void 0)return c;let{openAll:g,closeAll:S}=p;if(c.includes("\x1B"))for(;p!==void 0;)c=W_t(c,p.close,p.open),p=p.parent;let w=c.indexOf(`
980
980
  `);return w!==-1&&(c=U_t(c,S,g,w)),g+c+S};Object.defineProperties(fG.prototype,QR);var vlr=fG(),iwr=fG({level:G_t?G_t.level:0});var Qv=vlr;var Roe=class{report(c){console.log(Qv.bold(`
981
981
  \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`)),console.log(Qv.bold("Quality Lens Results")),console.log(Qv.bold(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
982
982
  `));let p=this.groupByPackage(c);Object.entries(p).forEach(([z,ie])=>{console.log(Qv.bold.blue(`\u{1F4E6} ${z}`)),ie.forEach(de=>{let be=de.result?.success?"\u2713":"\u2717",Ee=de.result?.success?Qv.green:Qv.red,Oe=de.result?.duration?`(${de.result.duration}ms)`:"";if(console.log(` ${Ee(be)} ${de.lens}: ${de.command} ${Qv.gray(Oe)}`),de.result?.lensResult?.issues&&de.result.lensResult.issues.length>0){let Y=de.result.lensResult.issues.filter(Ye=>Ye.severity==="error").length,ut=de.result.lensResult.issues.filter(Ye=>Ye.severity==="warning").length;Y>0&&console.log(` ${Qv.red(`${Y} error(s)`)}`),ut>0&&console.log(` ${Qv.yellow(`${ut} warning(s)`)}`)}de.error&&console.log(` ${Qv.red("Error:")} ${de.error}`)}),console.log("")});let g=c.length,S=c.filter(z=>z.result?.success).length,w=g-S;console.log(Qv.bold("Summary:")),console.log(` Total: ${g}`),console.log(` ${Qv.green("Passed:")} ${S}`),console.log(` ${Qv.red("Failed:")} ${w}`),console.log("")}groupByPackage(c){return c.reduce((p,g)=>(p[g.package]||(p[g.package]=[]),p[g.package].push(g),p),{})}};var _G=class{static buildTreeFromPaths(c,p=""){let g=p.endsWith("/")?p.slice(0,-1):p,S=new Map,w=[],z=[],ie=new Set;c.forEach(Ee=>{let Oe=Ee.split("/");for(let Y=1;Y<Oe.length;Y++)ie.add(Oe.slice(0,Y).join("/"))}),Array.from(ie).forEach(Ee=>{let Oe=Ee.split("/"),Y=Oe[Oe.length-1]||"",ut=Oe.length-1,Ye={path:Ee,name:Y,children:[],fileCount:0,totalSize:0,depth:ut,relativePath:this.calculateRelativePath(Ee,g)};S.set(Ee,Ye),z.push(Ye)}),c.forEach(Ee=>{let Oe=Ee.split("/"),Y=Oe[Oe.length-1]||"",ut=this.extractExtension(Y),Ye=Oe.slice(0,-1).join("/"),We={path:Ee,name:Y,extension:ut,size:0,lastModified:new Date,isDirectory:!1,relativePath:this.calculateRelativePath(Ee,g)};w.push(We);let Ut=S.get(Ye);Ut&&"children"in Ut&&(Ut.children.push(We),Ut.fileCount++)}),Array.from(ie).sort((Ee,Oe)=>Oe.length-Ee.length).forEach(Ee=>{let Oe=Ee.split("/");if(Oe.length>1){let Y=Oe.slice(0,-1).join("/"),ut=S.get(Y),Ye=S.get(Ee);ut&&Ye&&"children"in ut&&ut.children.push(Ye)}});let de=g&&g.split("/").pop()||"root",be=[];return z.forEach(Ee=>{Ee.path.split("/").length===1&&be.push(Ee)}),w.forEach(Ee=>{Ee.path.split("/").length===1&&be.push(Ee)}),{root:{path:g||".",name:de,children:be,fileCount:w.length,totalSize:0,depth:0,relativePath:""},allFiles:w,allDirectories:z}}static buildTreeFromFileInfos(c,p=""){let g=p.endsWith("/")?p.slice(0,-1):p,S=new Map,w=[],z=new Set;c.forEach(be=>{let Ee=be.path.split("/");for(let Oe=1;Oe<Ee.length;Oe++)z.add(Ee.slice(0,Oe).join("/"))}),Array.from(z).forEach(be=>{let Ee=be.split("/"),Oe=Ee[Ee.length-1]||"",Y={path:be,name:Oe,children:[],fileCount:0,totalSize:0,depth:Ee.length-1,relativePath:this.calculateRelativePath(be,g)};S.set(be,Y),w.push(Y)}),c.forEach(be=>{let Ee=be.path.split("/").slice(0,-1).join("/"),Oe=S.get(Ee);Oe&&(Oe.children.push(be),Oe.fileCount++,Oe.totalSize+=be.size||0)}),Array.from(z).sort((be,Ee)=>Ee.length-be.length).forEach(be=>{let Ee=be.split("/");if(Ee.length>1){let Oe=Ee.slice(0,-1).join("/"),Y=S.get(Oe),ut=S.get(be);Y&&ut&&(Y.children.push(ut),Y.fileCount+=ut.fileCount,Y.totalSize+=ut.totalSize)}});let ie=g&&g.split("/").pop()||"root",de=[];return w.forEach(be=>{be.path.split("/").length===1&&de.push(be)}),c.forEach(be=>{be.path.split("/").length===1&&de.push(be)}),{root:{path:g||".",name:ie,children:de,fileCount:c.length,totalSize:c.reduce((be,Ee)=>be+(Ee.size||0),0),depth:0,relativePath:""},allFiles:c,allDirectories:w}}static calculateStats(c,p){return{totalFiles:c.length,totalDirectories:p.length,totalSize:c.reduce((g,S)=>g+(S.size||0),0),maxDepth:this.calculateMaxDepth(p)}}static calculateMaxDepth(c){return c.length===0?0:Math.max(...c.map(p=>p.depth||0))}static extractExtension(c){if(!c.includes("."))return"";let p=c.split(".");return"."+p[p.length-1].toLowerCase()}static calculateRelativePath(c,p){if(!p||p===""||p===".")return c;if(c===p)return"";if(c.startsWith(p)){let g=c.substring(p.length);return g.startsWith("/")?g.substring(1):g}return c}static hashPaths(c){let p=[...c].sort().join(`
983
- `),g=0;for(let S=0;S<p.length;S++){let w=p.charCodeAt(S);g=(g<<5)-g+w,g=g&g}return`paths-${Math.abs(g).toString(36)}`}static simpleHash(c){let p=0;for(let g=0;g<c.length;g++){let S=c.charCodeAt(g);p=(p<<5)-p+S,p=p&p}return Math.abs(p).toString(36)}},Kke=class{generateTimestampId(){return Date.now().toString(36)}simpleHash(c){let p=0;for(let g=0;g<c.length;g++){let S=c.charCodeAt(g);p=(p<<5)-p+S,p=p&p}return Math.abs(p).toString(36)}},Moe=class extends Kke{build(c){let{files:p,rootPath:g=""}=c,{root:S,allFiles:w,allDirectories:z}=_G.buildTreeFromPaths(p,g),ie=_G.calculateStats(w,z);return{sha:this.calculateSha(c),metadata:this.generateMetadata(c),root:S,allFiles:w,allDirectories:z,stats:ie}}generateMetadata(c){let{files:p,rootPath:g=""}=c,S=this.calculateSha(c);return{id:`paths-${S}-${this.generateTimestampId()}`,timestamp:new Date,sourceType:"paths",sourceSha:S,sourceInfo:{fileCount:p.length,rootPath:g||"."}}}calculateSha(c){return _G.hashPaths(c.files)}};var Qg=Iy(zke()),wk=Iy(require("fs/promises")),Ik=Iy(require("path")),H_t=require("child_process");function Dlr(_){let p={eslint:()=>new Qg.ESLintLens,lint:()=>new Qg.ESLintLens,jest:()=>new Qg.JestLens,test:()=>new Qg.JestLens,typescript:()=>new Qg.TypeScriptLens,typecheck:()=>new Qg.TypeScriptLens,tsc:()=>new Qg.TypeScriptLens,knip:()=>new Qg.KnipLens,prettier:()=>new Qg.PrettierLens,format:()=>new Qg.PrettierLens,alexandria:()=>new Qg.AlexandriaLens,docs:()=>new Qg.AlexandriaLens}[_.toLowerCase()];return p?p():null}function blr(_,c,p,g,S){let w=Dlr(_);if(w)try{w.configure({cwd:S,tool:{name:_,command:_,args:[],cwd:S,available:!0}});let z={stdout:c,stderr:p,exitCode:g,duration:0},ie=w.parse(z);return{...w.format(ie),raw:{stdout:c,stderr:p,exitCode:g}}}catch(z){console.log(` [parse] Could not parse ${_} output: ${z instanceof Error?z.message:"unknown error"}`);return}}var Clr=`name: Quality Lens Analysis
983
+ `),g=0;for(let S=0;S<p.length;S++){let w=p.charCodeAt(S);g=(g<<5)-g+w,g=g&g}return`paths-${Math.abs(g).toString(36)}`}static simpleHash(c){let p=0;for(let g=0;g<c.length;g++){let S=c.charCodeAt(g);p=(p<<5)-p+S,p=p&p}return Math.abs(p).toString(36)}},Kke=class{generateTimestampId(){return Date.now().toString(36)}simpleHash(c){let p=0;for(let g=0;g<c.length;g++){let S=c.charCodeAt(g);p=(p<<5)-p+S,p=p&p}return Math.abs(p).toString(36)}},Moe=class extends Kke{build(c){let{files:p,rootPath:g=""}=c,{root:S,allFiles:w,allDirectories:z}=_G.buildTreeFromPaths(p,g),ie=_G.calculateStats(w,z);return{sha:this.calculateSha(c),metadata:this.generateMetadata(c),root:S,allFiles:w,allDirectories:z,stats:ie}}generateMetadata(c){let{files:p,rootPath:g=""}=c,S=this.calculateSha(c);return{id:`paths-${S}-${this.generateTimestampId()}`,timestamp:new Date,sourceType:"paths",sourceSha:S,sourceInfo:{fileCount:p.length,rootPath:g||"."}}}calculateSha(c){return _G.hashPaths(c.files)}};var Qg=Iy(zke()),wk=Iy(require("fs/promises")),Ik=Iy(require("path")),H_t=require("child_process");function Dlr(_){let p={eslint:()=>new Qg.ESLintLens,lint:()=>new Qg.ESLintLens,jest:()=>new Qg.JestLens,test:()=>new Qg.JestLens,typescript:()=>new Qg.TypeScriptLens,typecheck:()=>new Qg.TypeScriptLens,tsc:()=>new Qg.TypeScriptLens,knip:()=>new Qg.KnipLens,prettier:()=>new Qg.PrettierLens,format:()=>new Qg.PrettierLens,alexandria:()=>new Qg.AlexandriaLens,docs:()=>new Qg.AlexandriaLens}[_.toLowerCase()];return p?p():null}function blr(_,c,p,g,S){let w=Dlr(_);if(w)try{w.configure({cwd:S,tool:{name:_,command:_,args:[],cwd:S,available:!0}});let z={stdout:c,stderr:p,exitCode:g,duration:0},ie=w.parse(z);return{...w.format(ie),success:!0,raw:{stdout:c,stderr:p,exitCode:g}}}catch(z){console.log(` [parse] Could not parse ${_} output: ${z instanceof Error?z.message:"unknown error"}`);return}}var Clr=`name: Quality Lens Analysis
984
984
 
985
985
  on:
986
986
  push:
@@ -1001,26 +1001,91 @@ jobs:
1001
1001
  with:
1002
1002
  node-version: '20'
1003
1003
 
1004
+ - name: Install project dependencies
1005
+ run: npm ci
1006
+ continue-on-error: true
1007
+
1004
1008
  - name: Install Quality Lens CLI
1005
1009
  run: npm install -g @principal-ai/quality-lens-cli
1006
1010
 
1007
1011
  - name: Run quality lenses
1008
- run: quality-lens run . --install --output results.json --format json
1012
+ run: quality-lens run . --output results.json --format json
1009
1013
 
1010
1014
  - name: Display results summary
1011
1015
  if: always()
1012
1016
  run: |
1013
1017
  if [ -f results.json ]; then
1014
- echo "Quality Lens Analysis Complete"
1018
+ echo ""
1019
+ echo "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"
1020
+ echo " QUALITY LENS RESULTS"
1021
+ echo "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"
1015
1022
  node -e "
1016
1023
  const fs = require('fs');
1017
1024
  const results = JSON.parse(fs.readFileSync('results.json', 'utf8'));
1018
- const total = results.results.length;
1019
- const passed = results.results.filter(r => r.execution?.success).length;
1020
- console.log('Total Checks:', total);
1021
- console.log('Passed:', passed);
1022
- console.log('Failed:', total - passed);
1025
+
1026
+ // Show hexagon scores
1027
+ const hex = results.qualityMetrics?.hexagon || {};
1028
+ console.log('');
1029
+ console.log('Quality Hexagon Scores:');
1030
+ console.log('\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500');
1031
+ const dimensions = ['tests', 'linting', 'types', 'formatting', 'deadCode', 'documentation'];
1032
+ for (const dim of dimensions) {
1033
+ const score = hex[dim] ?? 0;
1034
+ const bar = '\u2588'.repeat(Math.floor(score / 10)) + '\u2591'.repeat(10 - Math.floor(score / 10));
1035
+ const status = score === 0 ? '\u26A0\uFE0F NEEDS SETUP' : score >= 80 ? '\u2705' : score >= 50 ? '\u26A1' : '\u26A0\uFE0F';
1036
+ console.log(\` \${dim.padEnd(14)} \${bar} \${score.toString().padStart(3)}% \${status}\`);
1037
+ }
1038
+
1039
+ // Show lens details
1040
+ console.log('');
1041
+ console.log('Lens Execution Details:');
1042
+ console.log('\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500');
1043
+ for (const r of results.results) {
1044
+ const success = r.execution?.success;
1045
+ const hasIssues = (r.issues?.length || 0) > 0;
1046
+ const hasMetrics = r.metrics && Object.keys(r.metrics).length > 0;
1047
+ const exitCode = r.execution?.exitCode;
1048
+
1049
+ let status = '\u2705 OK';
1050
+ let note = '';
1051
+
1052
+ if (!success) {
1053
+ status = '\u274C FAILED';
1054
+ note = ' - Tool could not run';
1055
+ } else if (!hasMetrics && !hasIssues) {
1056
+ status = '\u26A0\uFE0F NO DATA';
1057
+ if (exitCode === 2) {
1058
+ note = ' - Config error (check eslint/tsconfig)';
1059
+ } else {
1060
+ note = ' - Could not parse output';
1061
+ }
1062
+ } else if (hasIssues) {
1063
+ status = \`\u{1F4CB} \${r.issues.length} issues\`;
1064
+ }
1065
+
1066
+ console.log(\` \${r.lens.id.padEnd(12)} \${status}\${note}\`);
1067
+ }
1068
+
1069
+ // Show action items if needed
1070
+ const needsAttention = results.results.filter(r =>
1071
+ !r.execution?.success ||
1072
+ (!r.issues?.length && !r.metrics?.totalIssues && r.execution?.exitCode !== 0)
1073
+ );
1074
+
1075
+ if (needsAttention.length > 0) {
1076
+ console.log('');
1077
+ console.log('\u26A0\uFE0F ACTION REQUIRED:');
1078
+ console.log('\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500');
1079
+ console.log('Some lenses could not run properly. Common fixes:');
1080
+ console.log(' \u2022 ESLint: Ensure .eslintrc or eslint.config.js exists');
1081
+ console.log(' \u2022 Jest: Ensure jest.config.js and test files exist');
1082
+ console.log(' \u2022 TypeScript: Ensure tsconfig.json is valid');
1083
+ console.log(' \u2022 Run "npm ci" locally to verify dependencies');
1084
+ }
1085
+
1086
+ console.log('');
1023
1087
  "
1088
+ echo "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"
1024
1089
  fi
1025
1090
 
1026
1091
  - name: Upload results artifact
@@ -1 +1 @@
1
- {"version":3,"file":"JsonFormatter.d.ts","sourceRoot":"","sources":["../../src/output/JsonFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG3E,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AAKrE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAKD,qBAAa,aAAa;IAIxB,OAAO,CAAC,yBAAyB;IAwBjC,OAAO,CAAC,mBAAmB;IAiD3B,OAAO,CAAC,uBAAuB;IA4B/B,OAAO,CAAC,cAAc;IA8BtB,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,MAAM;CA4C/C"}
1
+ {"version":3,"file":"JsonFormatter.d.ts","sourceRoot":"","sources":["../../src/output/JsonFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG3E,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;AAKrE,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAKD,qBAAa,aAAa;IAIxB,OAAO,CAAC,yBAAyB;IAwBjC,OAAO,CAAC,mBAAmB;IAoD3B,OAAO,CAAC,uBAAuB;IA4B/B,OAAO,CAAC,cAAc;IA8BtB,MAAM,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,MAAM;CA4C/C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/quality-lens-cli",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "CLI tool for running quality lenses on codebases in CI/CD pipelines",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",