@wispbit/local 1.0.61 → 1.0.62
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/cli-bundle.js +3 -3
- package/package.json +1 -1
package/cli-bundle.js
CHANGED
|
@@ -240,7 +240,7 @@ ${o.join(`
|
|
|
240
240
|
`);s.trim()===n&&(yield s)}},XTt=function*(t,e){let n=e.split(`
|
|
241
241
|
`);if(n.length<3)return;n[n.length-1]===""&&n.pop();let r=t.split(`
|
|
242
242
|
`),i=n[0].trim(),o=n[n.length-1].trim();for(let s=0;s<r.length;s++)if(r[s].trim()===i){for(let a=s+2;a<r.length;a++)if(r[a].trim()===o){let c=r.slice(s,a+1),u=c.join(`
|
|
243
|
-
`);if(c.length===n.length){let l=0,E=0;for(let T=1;T<c.length-1;T++){let S=c[T].trim(),d=n[T].trim();(S.length>0||d.length>0)&&(E++,S===d&&l++)}if(E===0||l/E>=.5){yield u;break}}break}}};function JTt(t,e,n,r=!1){if(e===n)return t;let i=!0;for(let o of[YTt,HTt,jTt,WTt,KTt,qTt,ZTt,XTt,zTt])for(let s of o(t,e)){let a=t.indexOf(s);if(a===-1)continue;if(i=!1,r)return t.replaceAll(s,n);let c=t.lastIndexOf(s);if(a===c)return t.substring(0,a)+n+t.substring(a+s.length)}throw i?new Error("oldString not found in content"):new Error("Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match.")}function a1e(t,e){return JTt(t,e.oldString,e.newString,e.replaceAll)}var ZI=class t{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(t.isIncremental(r)){let i=l1e(r.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+r.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,l=c1e(r.text,!1,o);if(c-a===l.length)for(let T=0,S=l.length;T<S;T++)u[T+a+1]=l[T];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));let E=r.text.length-(s-o);if(E!==0)for(let T=a+1+l.length,S=u.length;T<S;T++)u[T]=u[T]+E}else if(t.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=c1e(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let s=Math.floor((r+i)/2);n[s]>e?i=s:r=s+1}let o=r-1;return e=this.ensureBeforeEOL(e,n[o]),{line:o,character:e-n[o]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line];if(e.character<=0)return r;let i=e.line+1<n.length?n[e.line+1]:this._content.length,o=Math.min(r+e.character,i);return this.ensureBeforeEOL(o,r)}ensureBeforeEOL(e,n){for(;e>n&&u1e(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},iA;(function(t){function e(i,o,s,a){return new ZI(i,o,s,a)}t.create=e;function n(i,o,s){if(i instanceof ZI)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,o){let s=i.getText(),a=VF(o.map(QTt),(l,E)=>{let T=l.range.start.line-E.range.start.line;return T===0?l.range.start.character-E.range.start.character:T}),c=0,u=[];for(let l of a){let E=i.offsetAt(l.range.start);if(E<c)throw new Error("Overlapping edit");E>c&&u.push(s.substring(c,E)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=r})(iA||(iA={}));function VF(t,e){if(t.length<=1)return t;let n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);VF(r,e),VF(i,e);let o=0,s=0,a=0;for(;o<r.length&&s<i.length;)e(r[o],i[s])<=0?t[a++]=r[o++]:t[a++]=i[s++];for(;o<r.length;)t[a++]=r[o++];for(;s<i.length;)t[a++]=i[s++];return t}function c1e(t,e,n=0){let r=e?[n]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);u1e(o)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function u1e(t){return t===13||t===10}function l1e(t){let e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function QTt(t){let e=l1e(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var XI=class{syncedDocuments=new Map;diagnosticsByFileAndRule=new Map;dismissalsByFile=new Map;listen(e,n){e.onDidOpenTextDocument(r=>{let i=r.textDocument,o=iA.create(i.uri,i.languageId,i.version,i.text);this.syncedDocuments.set(i.uri,o)}),e.onDidChangeTextDocument(r=>{let i=r.textDocument,o=r.contentChanges;if(o.length===0)return;let s=i.version;if(s==null)return;let a=this.syncedDocuments.get(i.uri);a&&(a=iA.update(a,o,s),this.syncedDocuments.set(i.uri,a),n.onDidChangeContent?.(i.uri,a,o))}),e.onDidCloseTextDocument(r=>{this.syncedDocuments.delete(r.textDocument.uri)}),e.onDidSaveTextDocument(r=>{let i=this.syncedDocuments.get(r.textDocument.uri);i&&n.onDidSave?.(r.textDocument.uri,i)})}getDocument(e){return this.syncedDocuments.get(e)}getAllDocumentUris(){return Array.from(this.syncedDocuments.values()).map(e=>e.uri)}setDiagnosticsForRule(e,n,r){this.diagnosticsByFileAndRule.has(e)||this.diagnosticsByFileAndRule.set(e,new Map),this.diagnosticsByFileAndRule.get(e).set(n,r)}getDiagnostics(e){let n=this.diagnosticsByFileAndRule.get(e);if(!n)return[];let r=[];for(let[i,o]of n.entries())r.push(...o);return r}clearDiagnostics(e){this.diagnosticsByFileAndRule.delete(e)}setDismissals(e,n){this.dismissalsByFile.set(e,n)}getDismissals(e){return this.dismissalsByFile.get(e)||[]}hasDismissals(e){return this.dismissalsByFile.has(e)}clearDismissals(e){this.dismissalsByFile.delete(e)}};function rSt(t,e,n){if(t.fingerprint)return`${e}:${t.fingerprint}`;let r=t.text?.slice(0,100)||"",i=`${t.range.start.line}:${t.range.start.column}-${t.range.end.line}:${t.range.end.column}`;return`${e}:${n}:${i}:${iSt(r)}`}function iSt(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return e.toString(36)}var GF=class{connection;documentManager;ruleProvider;eventEmitter;config;environment;commitSelector;diffInclude;cachedRules=null;rulesById=new Map;rulesCacheTimestamp=0;rulesLoadingPromise=null;RULES_CACHE_TTL_MS=300*1e3;ruleExecutor=null;isExecuting=!1;batchProgressReporter=null;batchProgressToken="wispbit-batch-lint";progressTokenCreated=!1;progressDelayTimer=null;PROGRESS_DELAY_MS=1e4;fixQueue=[];isProcessingFix=!1;currentExecutionRules=[];completedRulesCount=0;constructor(e,n){this.config=e,this.environment=n,this.connection=(0,pr.createConnection)(pr.ProposedFeatures.all),this.documentManager=new XI,this.ruleProvider=new na(e,n),this.eventEmitter=new Xr,this.ruleExecutor=new Gc(this.config,this.environment,this.eventEmitter),this.setupProgressListeners(),this.initializeDiffMode(),this.registerHandlers()}async initializeDiffMode(){let e=this.environment.getWorkspaceRoot(),n=await lp(e);this.commitSelector=n.commitSelector,this.diffInclude=n.include,this.connection.console.log(`LSP Server: Using diff mode with selector ${this.commitSelector} and includes [${this.diffInclude.join(", ")}]`)}async updateDiagnosticsForRuleMatches(e,n,r){if(!this.currentExecutionRules.find(a=>a.internalId===e)){this.connection.console.log(`Warning: Rule ${e} not found in current execution`);return}let o=new Map;for(let a of n){let c=a.file.path;o.has(c)||o.set(c,[]),o.get(c).push(a)}let s=new Set(o.keys());if(r)for(let a of this.documentManager.getAllDocumentUris()){let c=qT(a),u=this.toRelativePath(c);this.documentManager.getDiagnostics(a).some(E=>E.data?.rule?.id===e)&&s.add(u)}for(let a of s){let c=o.get(a)||[],u=await this.createDiagnosticsForFile(a,e,c,this.currentExecutionRules),l=JI(this.environment.getWorkspaceRoot()+"/"+a).toString();this.updateDiagnosticsForRule(l,e,u)}}async handleRulePartial(e,n,r){if(!this.isExecuting||this.currentExecutionRules.length===0)return;await this.updateDiagnosticsForRuleMatches(e,n,!1);let i=this.currentExecutionRules.find(o=>o.internalId===e);i&&this.connection.console.log(`Partial results for rule ${i.id}: ${n.length} of ${r} matches ready`)}async handleRuleComplete(e,n){if(!this.isExecuting||this.currentExecutionRules.length===0)return;this.completedRulesCount++;let r=Math.round(this.completedRulesCount/this.currentExecutionRules.length*100);this.updateBatchProgress(r,e);let i=this.currentExecutionRules.find(o=>o.id===e);if(!i){this.connection.console.log(`Warning: Rule ${e} not found in current execution`);return}await this.updateDiagnosticsForRuleMatches(i.internalId,n,!0)}setupProgressListeners(){this.eventEmitter.on("rules:progress",e=>{this.updateBatchProgress(e.percentage,e.ruleId)}),this.eventEmitter.on("rules:rule-partial",async e=>{await this.handleRulePartial(e.ruleId,e.matches,e.totalMatches)}),this.eventEmitter.on("rules:rule-complete",async e=>{await this.handleRuleComplete(e.ruleId,e.matches)})}toRelativePath(e){let n=this.environment.getWorkspaceRoot();return tSt(n,e)}updateDiagnosticsForRule(e,n,r){this.documentManager.setDiagnosticsForRule(e,n,r);let i=this.documentManager.getDiagnostics(e);this.connection.sendDiagnostics({uri:e,diagnostics:i})}removeDiagnosticByMatchId(e,n){let r=this.documentManager.getDiagnostics(e),i=r.find(a=>a.data?.matchId===n);if(!i)return;let o=i.data?.rule?.id;if(!o)return;let s=r.filter(a=>a.data?.rule?.id===o&&a.data?.matchId!==n);this.updateDiagnosticsForRule(e,o,s)}handleDocumentChangesWithRanges(e,n){let r=this.documentManager.getDiagnostics(e);if(r.length===0)return;this.connection.console.log(`Document changed: ${e}, ${n.length} change(s), ${r.length} diagnostic(s)`);let i=new Set;for(let o of n){if(!o.range){this.connection.console.log("Full document change detected - removing all diagnostics");for(let s of r)s.data?.matchId&&i.add(s.data.matchId);continue}this.connection.console.log(`Change at lines ${o.range.start.line}-${o.range.end.line}`);for(let s of r)this.rangesOverlap(o.range,s.range)&&(this.connection.console.log(` Removing diagnostic at lines ${s.range.start.line}-${s.range.end.line}`),s.data?.matchId&&i.add(s.data.matchId))}for(let o of i)this.removeDiagnosticByMatchId(e,o);i.size>0&&this.connection.console.log(`Removed ${i.size} diagnostic(s) due to document edits`)}rangesOverlap(e,n){return e.end.line<n.start.line||e.start.line>n.end.line?!1:e.start.line<=n.end.line&&e.end.line>=n.start.line}async createDiagnosticsForFile(e,n,r,i){this.documentManager.hasDismissals(e)||await this.loadDismissalsForFile(e);let o={ruleId:n,matches:r},s=this.filterDismissedResults([o],e),a=JI(this.environment.getWorkspaceRoot()+"/"+e).toString();return await this.convertResultsToDiagnostics(s,i,a)}async getFileContent(e){let n=JI(e).toString(),r=this.documentManager.getDocument(n);return r?r.getText():await eSt.readFile(e,"utf-8").catch(i=>(this.connection.console.warn(`Could not read file ${e}: ${i.message}`),null))}async computeFixForMatch(e){if(!e.edits||e.edits.length===0)return null;let n=this.environment.getWorkspaceRoot(),r=new Map,i=new Map;for(let o of e.edits){let s=nSt(n,o.filePath),a=r.get(s);if(!a){let u=await this.getFileContent(s);if(u===null)return null;a=u,i.set(s,a)}let c=a1e(a,o);r.set(s,c)}return{fileChanges:Array.from(r.entries()).map(([o,s])=>{let a=i.get(o),c=o1e(a,s);return{filePath:o,fileUri:JI(o).toString(),oldContent:a,newContent:s,diff:c}})}}async loadRulesWithCache(){let n=Date.now()-this.rulesCacheTimestamp;return this.cachedRules&&n<this.RULES_CACHE_TTL_MS?(this.connection.console.log(`Using cached rules (age: ${Math.round(n/1e3)}s / ${this.RULES_CACHE_TTL_MS/1e3}s)`),this.cachedRules):this.rulesLoadingPromise?(this.connection.console.log("Rules are already being loaded, waiting for existing request..."),this.rulesLoadingPromise):(this.connection.console.log("Loading fresh rules from API..."),this.rulesLoadingPromise=this.ruleProvider.loadAllRules().then(r=>{this.cachedRules=r,this.rulesCacheTimestamp=Date.now(),this.rulesById.clear();for(let i of r)this.rulesById.set(i.id,i);if(this.connection.console.log(`Loaded ${r.length} rules (cache valid for ${this.RULES_CACHE_TTL_MS/1e3}s)`),r.length>0){this.connection.console.log("Fetched rules:");for(let i of r){let o=i.autofix||!1,s=i.quickfix||!1,a="";o?a=" (autofix)":s?a=" (quickfix)":a=" (nofix)",this.connection.console.log(` - ${i.id}: ${i.message}${a}`)}}return r}).finally(()=>{this.rulesLoadingPromise=null}),await this.rulesLoadingPromise)}async loadDismissalsForFile(e){if(this.documentManager.hasDismissals(e)){this.connection.console.log(`Using cached dismissals for ${e}`);return}this.connection.console.log(`Loading dismissals from API for ${e}`);let r=(await this.ruleProvider.getDismissals([e])).map(i=>({ruleId:i.ruleId,file:i.match.file.path,startLine:i.match.range.start.line,endLine:i.match.range.end.line,fingerprint:i.match.fingerprint,dismissedAt:i.createdAt,dismissalId:i.dismissalId}));this.documentManager.setDismissals(e,r)}filterDismissedResults(e,n){let r=this.documentManager.getDismissals(n);return r.length===0?e:e.map(i=>{let o=r.filter(u=>u.ruleId===i.ruleId);if(o.length===0)return i;this.connection.console.log(`Filtering ${o.length} dismissed matches for rule ${i.ruleId} in ${n}`);let s=i.matches.map(u=>({file:n,startLine:u.range.start.line,endLine:u.range.end.line,fingerprint:u.fingerprint})),c=Kbe(s,o).map(u=>i.matches.find(l=>l.range.start.line===u.startLine&&l.range.end.line===u.endLine&&l.fingerprint===u.fingerprint));return{...i,matches:c}})}async convertResultsToDiagnostics(e,n,r){let i=[],o=new Set;for(let s of e){let a=n.find(c=>c.internalId===s.ruleId);if(!a){this.connection.console.log(`Warning: Could not find rule with internal ID ${s.ruleId}`);continue}for(let c of s.matches){let u=`${c.range.start.line}-${c.range.end.line}`;if(o.has(u))continue;o.add(u);let l=rSt(c,a.internalId,r),E=null;c.edits&&c.edits.length>0&&(E=await this.computeFixForMatch(c).catch(d=>(this.connection.console.log(`Warning: Failed to compute fix for match: ${d}`),null)));let T=E?.fileChanges[0]?.diff||null,S={range:{start:{line:c.range.start.line-1,character:c.range.start.column-1},end:{line:c.range.end.line-1,character:c.range.end.column-1}},severity:pr.DiagnosticSeverity.Warning,message:c.description||a.message,code:a.id,codeDescription:{href:`https://app.wispbit.com/rules/${a.internalId}`},source:"wispbit",data:{uri:r,match:c,matchId:l,fix:T?{diff:T,autofix:a.autofix||!1}:null,rule:{id:a.internalId,displayId:a.id,summary:a.summary||null}}};i.push(S)}}return i}triggerExecution(){this.executeQueuedFiles()}lintDocument(e){if(!this.documentManager.getDocument(e)){this.connection.console.log(`Document not found: ${e}`);return}let r=qT(e),i=this.toRelativePath(r);this.connection.console.log(`File changed: ${i}`),this.triggerExecution()}async executeQueuedFiles(){this.isExecuting=!0,this.connection.console.log("Executing rules for all changed files"),this.cleanupProgress(),this.scheduleProgressNotification();try{let e=await this.loadRulesWithCache();this.completedRulesCount=0,this.currentExecutionRules=e,await this.ruleExecutor.execute(e,{mode:"diff",diffOptions:{include:this.diffInclude,commitSelector:this.commitSelector,skipPreExistingViolations:!0}}),this.cleanupProgress()}catch(e){this.connection.console.error(`Error executing rules: ${e.message}`),this.connection.console.error(e.stack),this.cleanupProgress()}finally{this.isExecuting=!1}}scheduleProgressNotification(){this.progressDelayTimer&&(clearTimeout(this.progressDelayTimer),this.progressDelayTimer=null),this.progressDelayTimer=setTimeout(()=>{this.progressDelayTimer=null,this.isExecuting&&this.startBatchProgress(0)},this.PROGRESS_DELAY_MS)}async startBatchProgress(e){if(this.batchProgressReporter)this.batchProgressReporter.report(e,"Checking workspace");else try{this.progressTokenCreated||(await this.connection.sendRequest("window/workDoneProgress/create",{token:this.batchProgressToken}),this.progressTokenCreated=!0),this.batchProgressReporter=await this.connection.window.createWorkDoneProgress(),this.batchProgressReporter.begin("wispbit",e,"Checking workspace",!1)}catch(n){this.connection.console.log(`Failed to create batch progress: ${n}`)}}cleanupProgress(){this.progressDelayTimer&&(clearTimeout(this.progressDelayTimer),this.progressDelayTimer=null),this.batchProgressReporter&&(this.batchProgressReporter.done(),this.batchProgressReporter=null)}updateBatchProgress(e,n){if(!this.batchProgressReporter)return;let r=`Checking workspace (${n})`;this.batchProgressReporter.report(e,r)}async processFixQueue(){if(!this.isProcessingFix){for(this.isProcessingFix=!0;this.fixQueue.length>0;){let e=this.fixQueue.shift();e&&await e()}this.isProcessingFix=!1}}handleQuickfix(e){let{uri:n,matchId:r}=e[0];this.fixQueue.push(async()=>{await this.applyQuickfix(n,r)}),this.processFixQueue()}async applyQuickfix(e,n){let i=this.documentManager.getDiagnostics(e).find(u=>u.data?.matchId===n);if(!i){this.connection.window.showErrorMessage("Could not apply fix"),this.connection.console.error(`Diagnostic not found for matchId: ${n}`);return}let o=i.data?.match,s=i.data?.rule;if(!o?.edits||o.edits.length===0){this.connection.window.showErrorMessage("No fix available"),this.connection.console.error(`No fix available for matchId ${n}, rule ${s?.id}`);return}this.connection.console.log(`Applying fix for matchId ${n}, rule ${s?.id}`);let a=await this.computeFixForMatch(o);if(!a){this.connection.window.showErrorMessage("Failed to compute fix"),this.connection.console.error(`Failed to compute fix for matchId ${n}, rule ${s?.id}`);return}let c={};for(let u of a.fileChanges){let l=this.documentManager.getDocument(u.fileUri),E=l?l.lineCount:u.oldContent.split(`
|
|
243
|
+
`);if(c.length===n.length){let l=0,E=0;for(let T=1;T<c.length-1;T++){let S=c[T].trim(),d=n[T].trim();(S.length>0||d.length>0)&&(E++,S===d&&l++)}if(E===0||l/E>=.5){yield u;break}}break}}};function JTt(t,e,n,r=!1){if(e===n)return t;let i=!0;for(let o of[YTt,HTt,jTt,WTt,KTt,qTt,ZTt,XTt,zTt])for(let s of o(t,e)){let a=t.indexOf(s);if(a===-1)continue;if(i=!1,r)return t.replaceAll(s,n);let c=t.lastIndexOf(s);if(a===c)return t.substring(0,a)+n+t.substring(a+s.length)}throw i?new Error("oldString not found in content"):new Error("Found multiple matches for oldString. Provide more surrounding lines in oldString to identify the correct match.")}function a1e(t,e){return JTt(t,e.oldString,e.newString,e.replaceAll)}var ZI=class t{constructor(e,n,r,i){this._uri=e,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let n=this.offsetAt(e.start),r=this.offsetAt(e.end);return this._content.substring(n,r)}return this._content}update(e,n){for(let r of e)if(t.isIncremental(r)){let i=l1e(r.range),o=this.offsetAt(i.start),s=this.offsetAt(i.end);this._content=this._content.substring(0,o)+r.text+this._content.substring(s,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),u=this._lineOffsets,l=c1e(r.text,!1,o);if(c-a===l.length)for(let T=0,S=l.length;T<S;T++)u[T+a+1]=l[T];else l.length<1e4?u.splice(a+1,c-a,...l):this._lineOffsets=u=u.slice(0,a+1).concat(l,u.slice(c+1));let E=r.text.length-(s-o);if(E!==0)for(let T=a+1+l.length,S=u.length;T<S;T++)u[T]=u[T]+E}else if(t.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=c1e(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:e};for(;r<i;){let s=Math.floor((r+i)/2);n[s]>e?i=s:r=s+1}let o=r-1;return e=this.ensureBeforeEOL(e,n[o]),{line:o,character:e-n[o]}}offsetAt(e){let n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;let r=n[e.line];if(e.character<=0)return r;let i=e.line+1<n.length?n[e.line+1]:this._content.length,o=Math.min(r+e.character,i);return this.ensureBeforeEOL(o,r)}ensureBeforeEOL(e,n){for(;e>n&&u1e(this._content.charCodeAt(e-1));)e--;return e}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(e){let n=e;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},iA;(function(t){function e(i,o,s,a){return new ZI(i,o,s,a)}t.create=e;function n(i,o,s){if(i instanceof ZI)return i.update(o,s),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=n;function r(i,o){let s=i.getText(),a=VF(o.map(QTt),(l,E)=>{let T=l.range.start.line-E.range.start.line;return T===0?l.range.start.character-E.range.start.character:T}),c=0,u=[];for(let l of a){let E=i.offsetAt(l.range.start);if(E<c)throw new Error("Overlapping edit");E>c&&u.push(s.substring(c,E)),l.newText.length&&u.push(l.newText),c=i.offsetAt(l.range.end)}return u.push(s.substr(c)),u.join("")}t.applyEdits=r})(iA||(iA={}));function VF(t,e){if(t.length<=1)return t;let n=t.length/2|0,r=t.slice(0,n),i=t.slice(n);VF(r,e),VF(i,e);let o=0,s=0,a=0;for(;o<r.length&&s<i.length;)e(r[o],i[s])<=0?t[a++]=r[o++]:t[a++]=i[s++];for(;o<r.length;)t[a++]=r[o++];for(;s<i.length;)t[a++]=i[s++];return t}function c1e(t,e,n=0){let r=e?[n]:[];for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);u1e(o)&&(o===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,r.push(n+i+1))}return r}function u1e(t){return t===13||t===10}function l1e(t){let e=t.start,n=t.end;return e.line>n.line||e.line===n.line&&e.character>n.character?{start:n,end:e}:t}function QTt(t){let e=l1e(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var XI=class{syncedDocuments=new Map;diagnosticsByFileAndRule=new Map;dismissalsByFile=new Map;listen(e,n){e.onDidOpenTextDocument(r=>{let i=r.textDocument,o=iA.create(i.uri,i.languageId,i.version,i.text);this.syncedDocuments.set(i.uri,o)}),e.onDidChangeTextDocument(r=>{let i=r.textDocument,o=r.contentChanges;if(o.length===0)return;let s=i.version;if(s==null)return;let a=this.syncedDocuments.get(i.uri);a&&(a=iA.update(a,o,s),this.syncedDocuments.set(i.uri,a),n.onDidChangeContent?.(i.uri,a,o))}),e.onDidCloseTextDocument(r=>{this.syncedDocuments.delete(r.textDocument.uri)}),e.onDidSaveTextDocument(r=>{let i=this.syncedDocuments.get(r.textDocument.uri);i&&n.onDidSave?.(r.textDocument.uri,i)})}getDocument(e){return this.syncedDocuments.get(e)}getAllDocumentUris(){return Array.from(this.syncedDocuments.values()).map(e=>e.uri)}setDiagnosticsForRule(e,n,r){this.diagnosticsByFileAndRule.has(e)||this.diagnosticsByFileAndRule.set(e,new Map),this.diagnosticsByFileAndRule.get(e).set(n,r)}getDiagnostics(e){let n=this.diagnosticsByFileAndRule.get(e);if(!n)return[];let r=[];for(let[i,o]of n.entries())r.push(...o);return r}clearDiagnostics(e){this.diagnosticsByFileAndRule.delete(e)}setDismissals(e,n){this.dismissalsByFile.set(e,n)}getDismissals(e){return this.dismissalsByFile.get(e)||[]}hasDismissals(e){return this.dismissalsByFile.has(e)}clearDismissals(e){this.dismissalsByFile.delete(e)}};function rSt(t,e,n){if(t.fingerprint)return`${e}:${t.fingerprint}`;let r=t.text?.slice(0,100)||"",i=`${t.range.start.line}:${t.range.start.column}-${t.range.end.line}:${t.range.end.column}`;return`${e}:${n}:${i}:${iSt(r)}`}function iSt(t){let e=0;for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);e=(e<<5)-e+r,e=e&e}return e.toString(36)}var GF=class{connection;documentManager;ruleProvider;eventEmitter;config;environment;commitSelector;diffInclude;cachedRules=null;rulesById=new Map;rulesCacheTimestamp=0;rulesLoadingPromise=null;RULES_CACHE_TTL_MS=300*1e3;ruleExecutor=null;isExecuting=!1;batchProgressReporter=null;batchProgressToken="wispbit-batch-lint";progressTokenCreated=!1;progressDelayTimer=null;PROGRESS_DELAY_MS=1e4;fixQueue=[];isProcessingFix=!1;currentExecutionRules=[];completedRulesCount=0;constructor(e,n){this.config=e,this.environment=n,this.connection=(0,pr.createConnection)(pr.ProposedFeatures.all),this.documentManager=new XI,this.ruleProvider=new na(e,n),this.eventEmitter=new Xr,this.ruleExecutor=new Gc(this.config,this.environment,this.eventEmitter),this.setupProgressListeners(),this.initializeDiffMode(),this.registerHandlers()}async initializeDiffMode(){let e=this.environment.getWorkspaceRoot(),n=await lp(e);this.commitSelector=n.commitSelector,this.diffInclude=n.include,this.connection.console.log(`LSP Server: Using diff mode with selector ${this.commitSelector} and includes [${this.diffInclude.join(", ")}]`)}async updateDiagnosticsForRuleMatches(e,n,r){if(!this.currentExecutionRules.find(a=>a.internalId===e)){this.connection.console.log(`Warning: Rule ${e} not found in current execution`);return}let o=new Map;for(let a of n){let c=a.file.path;o.has(c)||o.set(c,[]),o.get(c).push(a)}let s=new Set(o.keys());if(r)for(let a of this.documentManager.getAllDocumentUris()){let c=qT(a),u=this.toRelativePath(c);this.documentManager.getDiagnostics(a).some(E=>E.data?.rule?.id===e)&&s.add(u)}for(let a of s){let c=o.get(a)||[],u=await this.createDiagnosticsForFile(a,e,c,this.currentExecutionRules),l=JI(this.environment.getWorkspaceRoot()+"/"+a).toString();this.updateDiagnosticsForRule(l,e,u)}}async handleRulePartial(e,n,r){if(!this.isExecuting||this.currentExecutionRules.length===0)return;await this.updateDiagnosticsForRuleMatches(e,n,!1);let i=this.currentExecutionRules.find(o=>o.internalId===e);i&&this.connection.console.log(`Partial results for rule ${i.id}: ${n.length} of ${r} matches ready`)}async handleRuleComplete(e,n){if(!this.isExecuting||this.currentExecutionRules.length===0)return;this.completedRulesCount++;let r=Math.round(this.completedRulesCount/this.currentExecutionRules.length*100);this.updateBatchProgress(r,e);let i=this.currentExecutionRules.find(o=>o.id===e);if(!i){this.connection.console.log(`Warning: Rule ${e} not found in current execution`);return}await this.updateDiagnosticsForRuleMatches(i.internalId,n,!0)}setupProgressListeners(){this.eventEmitter.on("rules:progress",e=>{this.updateBatchProgress(e.percentage,e.ruleId)}),this.eventEmitter.on("rules:rule-partial",async e=>{await this.handleRulePartial(e.ruleId,e.matches,e.totalMatches)}),this.eventEmitter.on("rules:rule-complete",async e=>{await this.handleRuleComplete(e.ruleId,e.matches)})}toRelativePath(e){let n=this.environment.getWorkspaceRoot();return tSt(n,e)}updateDiagnosticsForRule(e,n,r){this.documentManager.setDiagnosticsForRule(e,n,r);let i=this.documentManager.getDiagnostics(e);this.connection.sendDiagnostics({uri:e,diagnostics:i})}removeDiagnosticByMatchId(e,n){let r=this.documentManager.getDiagnostics(e),i=r.find(a=>a.data?.matchId===n);if(!i)return;let o=i.data?.rule?.id;if(!o)return;let s=r.filter(a=>a.data?.rule?.id===o&&a.data?.matchId!==n);this.updateDiagnosticsForRule(e,o,s)}handleDocumentChangesWithRanges(e,n){let r=this.documentManager.getDiagnostics(e);if(r.length===0)return;this.connection.console.log(`Document changed: ${e}, ${n.length} change(s), ${r.length} diagnostic(s)`);let i=new Set;for(let o of n){if(!o.range){this.connection.console.log("Full document change detected - removing all diagnostics");for(let s of r)s.data?.matchId&&i.add(s.data.matchId);continue}for(let s of r)this.rangesOverlap(o.range,s.range)&&(this.connection.console.log(` Removing diagnostic at lines ${s.range.start.line}-${s.range.end.line}`),s.data?.matchId&&i.add(s.data.matchId))}for(let o of i)this.removeDiagnosticByMatchId(e,o);i.size>0&&this.connection.console.log(`Removed ${i.size} diagnostic(s) due to document edits`)}rangesOverlap(e,n){return e.end.line<n.start.line||e.start.line>n.end.line?!1:e.start.line<=n.end.line&&e.end.line>=n.start.line}async createDiagnosticsForFile(e,n,r,i){this.documentManager.hasDismissals(e)||await this.loadDismissalsForFile(e);let o={ruleId:n,matches:r},s=this.filterDismissedResults([o],e),a=JI(this.environment.getWorkspaceRoot()+"/"+e).toString();return await this.convertResultsToDiagnostics(s,i,a)}async getFileContent(e){let n=JI(e).toString(),r=this.documentManager.getDocument(n);return r?r.getText():await eSt.readFile(e,"utf-8").catch(i=>(this.connection.console.warn(`Could not read file ${e}: ${i.message}`),null))}async computeFixForMatch(e){if(!e.edits||e.edits.length===0)return null;let n=this.environment.getWorkspaceRoot(),r=new Map,i=new Map;for(let o of e.edits){let s=nSt(n,o.filePath),a=r.get(s);if(!a){let u=await this.getFileContent(s);if(u===null)return null;a=u,i.set(s,a)}let c=a1e(a,o);r.set(s,c)}return{fileChanges:Array.from(r.entries()).map(([o,s])=>{let a=i.get(o),c=o1e(a,s);return{filePath:o,fileUri:JI(o).toString(),oldContent:a,newContent:s,diff:c}})}}async loadRulesWithCache(){let n=Date.now()-this.rulesCacheTimestamp;return this.cachedRules&&n<this.RULES_CACHE_TTL_MS?(this.connection.console.log(`Using cached rules (age: ${Math.round(n/1e3)}s / ${this.RULES_CACHE_TTL_MS/1e3}s)`),this.cachedRules):this.rulesLoadingPromise?(this.connection.console.log("Rules are already being loaded, waiting for existing request..."),this.rulesLoadingPromise):(this.connection.console.log("Loading fresh rules from API..."),this.rulesLoadingPromise=this.ruleProvider.loadAllRules().then(r=>{this.cachedRules=r,this.rulesCacheTimestamp=Date.now(),this.rulesById.clear();for(let i of r)this.rulesById.set(i.id,i);if(this.connection.console.log(`Loaded ${r.length} rules (cache valid for ${this.RULES_CACHE_TTL_MS/1e3}s)`),r.length>0){this.connection.console.log("Fetched rules:");for(let i of r){let o=i.autofix||!1,s=i.quickfix||!1,a="";o?a=" (autofix)":s?a=" (quickfix)":a=" (nofix)",this.connection.console.log(` - ${i.id}: ${i.message}${a}`)}}return r}).finally(()=>{this.rulesLoadingPromise=null}),await this.rulesLoadingPromise)}async loadDismissalsForFile(e){if(this.documentManager.hasDismissals(e)){this.connection.console.log(`Using cached dismissals for ${e}`);return}this.connection.console.log(`Loading dismissals from API for ${e}`);let r=(await this.ruleProvider.getDismissals([e])).map(i=>({ruleId:i.ruleId,file:i.match.file.path,startLine:i.match.range.start.line,endLine:i.match.range.end.line,fingerprint:i.match.fingerprint,dismissedAt:i.createdAt,dismissalId:i.dismissalId}));this.documentManager.setDismissals(e,r)}filterDismissedResults(e,n){let r=this.documentManager.getDismissals(n);return r.length===0?e:e.map(i=>{let o=r.filter(u=>u.ruleId===i.ruleId);if(o.length===0)return i;this.connection.console.log(`Filtering ${o.length} dismissed matches for rule ${i.ruleId} in ${n}`);let s=i.matches.map(u=>({file:n,startLine:u.range.start.line,endLine:u.range.end.line,fingerprint:u.fingerprint})),c=Kbe(s,o).map(u=>i.matches.find(l=>l.range.start.line===u.startLine&&l.range.end.line===u.endLine&&l.fingerprint===u.fingerprint));return{...i,matches:c}})}async convertResultsToDiagnostics(e,n,r){let i=[],o=new Set;for(let s of e){let a=n.find(c=>c.internalId===s.ruleId);if(!a){this.connection.console.log(`Warning: Could not find rule with internal ID ${s.ruleId}`);continue}for(let c of s.matches){let u=`${c.range.start.line}-${c.range.end.line}`;if(o.has(u))continue;o.add(u);let l=rSt(c,a.internalId,r),E=null;c.edits&&c.edits.length>0&&(E=await this.computeFixForMatch(c).catch(d=>(this.connection.console.log(`Warning: Failed to compute fix for match: ${d}`),null)));let T=E?.fileChanges[0]?.diff||null,S={range:{start:{line:c.range.start.line-1,character:c.range.start.column-1},end:{line:c.range.end.line-1,character:c.range.end.column-1}},severity:pr.DiagnosticSeverity.Warning,message:c.description||a.message,code:a.id,codeDescription:{href:`https://app.wispbit.com/rules/${a.internalId}`},source:"wispbit",data:{uri:r,match:c,matchId:l,fix:T?{diff:T,autofix:a.autofix||!1}:null,rule:{id:a.internalId,displayId:a.id,summary:a.summary||null}}};i.push(S)}}return i}triggerExecution(){this.executeQueuedFiles()}lintDocument(e){if(!this.documentManager.getDocument(e)){this.connection.console.log(`Document not found: ${e}`);return}let r=qT(e),i=this.toRelativePath(r);this.connection.console.log(`File changed: ${i}`),this.triggerExecution()}async executeQueuedFiles(){this.isExecuting=!0,this.connection.console.log("Executing rules for all changed files"),this.cleanupProgress(),this.scheduleProgressNotification();try{let e=await this.loadRulesWithCache();this.completedRulesCount=0,this.currentExecutionRules=e,await this.ruleExecutor.execute(e,{mode:"diff",diffOptions:{include:this.diffInclude,commitSelector:this.commitSelector,skipPreExistingViolations:!0}}),this.cleanupProgress()}catch(e){this.connection.console.error(`Error executing rules: ${e.message}`),this.connection.console.error(e.stack),this.cleanupProgress()}finally{this.isExecuting=!1}}scheduleProgressNotification(){this.progressDelayTimer&&(clearTimeout(this.progressDelayTimer),this.progressDelayTimer=null),this.progressDelayTimer=setTimeout(()=>{this.progressDelayTimer=null,this.isExecuting&&this.startBatchProgress(0)},this.PROGRESS_DELAY_MS)}async startBatchProgress(e){if(this.batchProgressReporter)this.batchProgressReporter.report(e,"Checking workspace");else try{this.progressTokenCreated||(await this.connection.sendRequest("window/workDoneProgress/create",{token:this.batchProgressToken}),this.progressTokenCreated=!0),this.batchProgressReporter=await this.connection.window.createWorkDoneProgress(),this.batchProgressReporter.begin("wispbit",e,"Checking workspace",!1)}catch(n){this.connection.console.log(`Failed to create batch progress: ${n}`)}}cleanupProgress(){this.progressDelayTimer&&(clearTimeout(this.progressDelayTimer),this.progressDelayTimer=null),this.batchProgressReporter&&(this.batchProgressReporter.done(),this.batchProgressReporter=null)}updateBatchProgress(e,n){if(!this.batchProgressReporter)return;let r=`Checking workspace (${n})`;this.batchProgressReporter.report(e,r)}async processFixQueue(){if(!this.isProcessingFix){for(this.isProcessingFix=!0;this.fixQueue.length>0;){let e=this.fixQueue.shift();e&&await e()}this.isProcessingFix=!1}}handleQuickfix(e){let{uri:n,matchId:r}=e[0];this.fixQueue.push(async()=>{await this.applyQuickfix(n,r)}),this.processFixQueue()}async applyQuickfix(e,n){let i=this.documentManager.getDiagnostics(e).find(u=>u.data?.matchId===n);if(!i){this.connection.window.showErrorMessage("Could not apply fix"),this.connection.console.error(`Diagnostic not found for matchId: ${n}`);return}let o=i.data?.match,s=i.data?.rule;if(!o?.edits||o.edits.length===0){this.connection.window.showErrorMessage("No fix available"),this.connection.console.error(`No fix available for matchId ${n}, rule ${s?.id}`);return}this.connection.console.log(`Applying fix for matchId ${n}, rule ${s?.id}`);let a=await this.computeFixForMatch(o);if(!a){this.connection.window.showErrorMessage("Failed to compute fix"),this.connection.console.error(`Failed to compute fix for matchId ${n}, rule ${s?.id}`);return}let c={};for(let u of a.fileChanges){let l=this.documentManager.getDocument(u.fileUri),E=l?l.lineCount:u.oldContent.split(`
|
|
244
244
|
`).length;c[u.fileUri]=[{range:{start:{line:0,character:0},end:{line:E,character:0}},newText:u.newContent}]}await this.connection.workspace.applyEdit({changes:c}),this.connection.console.log("Applied fix successfully"),await this.ruleProvider.createFix(s?.id,o).catch(u=>{this.connection.console.log(`Failed to track fix: ${u.message}`)}),this.removeDiagnosticByMatchId(e,n)}async handleDismiss(e){let{uri:n,matchId:r}=e[0],i=qT(n),o=this.toRelativePath(i),s=this.documentManager.getDiagnostics(n).find(l=>l.data?.matchId===r);if(!s){this.connection.window.showErrorMessage("Could not dismiss violation"),this.connection.console.error(`Diagnostic not found for matchId: ${r}`);return}let a=s.data?.match,c=s.data?.rule?.id;if(!a){this.connection.window.showErrorMessage("Could not dismiss violation"),this.connection.console.error(`Match not found for matchId: ${r}`);return}await this.ruleProvider.createDismissal(c,a);let u=s.data?.rule?.displayId||c;this.connection.console.log(`Dismissed violation: ${u} with matchId ${r}`),this.removeDiagnosticByMatchId(n,r),this.documentManager.clearDismissals(o)}async handleGetDismissals(e){let{uri:n}=e[0];if(!n||typeof n!="string")return this.connection.console.log(`Invalid URI provided to getDismissals: ${n}`),[];if(!n.startsWith("file://"))return this.connection.console.log(`URI must be a file:// URL, got: ${n}`),[];let r=qT(n),i=this.toRelativePath(r);await this.loadDismissalsForFile(i);let o=this.documentManager.getDismissals(i),s=await this.loadRulesWithCache(),a=this.documentManager.getDocument(n);return o.map(c=>{let u=s.find(T=>T.internalId===c.ruleId),l="";if(a){let T=a.getText({start:{line:c.startLine-1,character:0},end:{line:c.startLine-1,character:100}});l=T.trim().substring(0,60),T.trim().length>60&&(l+="...")}let E="";if(c.dismissedAt){let T=new Date,S=new Date(c.dismissedAt),d=T.getTime()-S.getTime(),p=Math.floor(d/6e4),f=Math.floor(p/60),N=Math.floor(f/24);p<1?E="just now":p<60?E=`${p} minute${p===1?"":"s"} ago`:f<24?E=`${f} hour${f===1?"":"s"} ago`:E=`${N} day${N===1?"":"s"} ago`}return{dismissalId:c.dismissalId,ruleId:c.ruleId,displayId:u?.id||c.ruleId,ruleName:u?.message||"Unknown rule",line:c.startLine,fingerprint:c.fingerprint,fileName:i,codeSnippet:l,timeAgo:E}})}async handleUndismiss(e){let{uri:n,dismissalId:r}=e[0],i=qT(n),o=this.toRelativePath(i),a=this.documentManager.getDismissals(o).find(E=>E.dismissalId===r);if(!a){this.connection.window.showErrorMessage("Dismissal not found"),this.connection.console.error(`Dismissal not found with ID ${r}`);return}await this.ruleProvider.deleteDismissal(a.ruleId,a.file,a.fingerprint);let l=(await this.loadRulesWithCache()).find(E=>E.internalId===a.ruleId)?.id||a.ruleId;this.connection.console.log(`Undismissed violation: ${l}`),this.documentManager.clearDismissals(o),this.triggerExecution()}async handleRemember(e){let{uri:n,range:r,selectedText:i,note:o}=e[0],s=qT(n),a=this.toRelativePath(s);if(!o||o.trim().length===0){this.connection.window.showErrorMessage("Note is required to remember a pattern");return}let u=this.documentManager.getDiagnostics(n).filter(l=>l.source==="wispbit"&&l.data?.match).map(l=>({...l.data.match,ruleId:l.data.rule?.id}));this.connection.console.log(`Remembering pattern with ${u.length} matches: ${i.substring(0,100)}...`),this.connection.console.log(`Note: ${o}`);try{await this.ruleProvider.rememberPattern(a,i,{start:{line:r.start.line+1,column:r.start.character+1},end:{line:r.end.line+1,column:r.end.character+1}},o.trim(),u),this.connection.window.showInformationMessage(`Pattern remembered with ${u.length} match(es). Note: ${o.trim()}`)}catch(l){this.connection.console.log(`Failed to remember: ${l.message}`),this.connection.window.showErrorMessage(`Failed to remember: ${l.message}`)}}generateCodeActions(e,n){let r=[],i=e.uri,o=n.filter(u=>u.source==="wispbit"),s=o.filter(u=>u.data?.fix),a=s.length>1&&s.some((u,l)=>s.slice(l+1).some(E=>u.range.start.line<=E.range.end.line&&u.range.end.line>=E.range.start.line)),c=!1;for(let u of o){let l=u.data?.fix,E=l?.autofix||!1;l&&(r.push({title:`Fix: ${u.message}`,kind:pr.CodeActionKind.QuickFix,command:{title:"Apply Fix",command:"wispbit.quickfix",arguments:[{uri:i,matchId:u.data?.matchId}]},diagnostics:[u],isPreferred:!a&&!c}),c=!0,E&&r.push({title:`Fix: ${u.message}`,kind:pr.CodeActionKind.SourceFixAll,command:{title:"Apply Fix",command:"wispbit.quickfix",arguments:[{uri:i,matchId:u.data?.matchId}]},diagnostics:[u],isPreferred:!1})),r.push({title:`Dismiss: ${u.message}`,kind:pr.CodeActionKind.QuickFix,command:{title:"Dismiss",command:"wispbit.dismiss",arguments:[{uri:i,matchId:u.data?.matchId}]},diagnostics:[u]})}return r}generateHover(e,n){let r=e.find(c=>n.line<c.range.start.line||n.line>c.range.end.line?!1:c.range.start.line===c.range.end.line?n.character>=c.range.start.character&&n.character<=c.range.end.character:n.line===c.range.start.line?n.character>=c.range.start.character:n.line===c.range.end.line?n.character<=c.range.end.character:!0);if(!r)return null;let i=String(r.code||""),o=this.rulesById.get(i),s=r.data?.fix,a="";return s?.diff&&(a+="```diff\n",a+=s.diff,a+="\n```\n\n"),o?.summary&&(o.summary.content&&(a+=`**Summary:** ${o.summary.content}
|
|
245
245
|
|
|
246
246
|
`),o.summary.badExample&&(a+=`**Bad example:**
|
|
@@ -255,7 +255,7 @@ ${o.summary.goodExample}
|
|
|
255
255
|
|
|
256
256
|
${o.reason}
|
|
257
257
|
|
|
258
|
-
`),{contents:{kind:pr.MarkupKind.Markdown,value:a}}}registerHandlers(){this.connection.onInitialize(e=>(this.connection.console.log(`Wispbit LSP server initialized for workspace: ${e.rootUri}`),{capabilities:{textDocumentSync:{openClose:!0,change:pr.TextDocumentSyncKind.Incremental,save:!0},codeActionProvider:{codeActionKinds:[pr.CodeActionKind.QuickFix,pr.CodeActionKind.SourceFixAll]},executeCommandProvider:{commands:["wispbit.quickfix","wispbit.dismiss","wispbit.remember","wispbit.getDismissals","wispbit.undismiss"]},hoverProvider:!0}})),this.connection.onInitialized(()=>{this.connection.console.log("LSP server initialized, running initial check..."),this.triggerExecution()}),this.connection.onCodeAction(e=>{let n=this.documentManager.getDocument(e.textDocument.uri);if(!n)return[];let r=e.context.diagnostics
|
|
258
|
+
`),{contents:{kind:pr.MarkupKind.Markdown,value:a}}}registerHandlers(){this.connection.onInitialize(e=>(this.connection.console.log(`Wispbit LSP server initialized for workspace: ${e.rootUri}`),{capabilities:{textDocumentSync:{openClose:!0,change:pr.TextDocumentSyncKind.Incremental,save:!0},codeActionProvider:{codeActionKinds:[pr.CodeActionKind.QuickFix,pr.CodeActionKind.SourceFixAll]},executeCommandProvider:{commands:["wispbit.quickfix","wispbit.dismiss","wispbit.remember","wispbit.getDismissals","wispbit.undismiss"]},hoverProvider:!0}})),this.connection.onInitialized(()=>{this.connection.console.log("LSP server initialized, running initial check..."),this.triggerExecution()}),this.connection.onCodeAction(e=>{let n=this.documentManager.getDocument(e.textDocument.uri);if(!n)return[];let r=e.context.diagnostics,i=e.context.only,o=this.generateCodeActions(n,r);return i&&i.length>0?o.filter(s=>s.kind?i.some(a=>s.kind?.startsWith(a)):!1):o}),this.connection.onHover(e=>{let n=this.documentManager.getDiagnostics(e.textDocument.uri);return this.generateHover(n,e.position)}),this.connection.onExecuteCommand(async e=>{switch(e.command){case"wispbit.quickfix":await this.handleQuickfix(e.arguments||[]);break;case"wispbit.dismiss":await this.handleDismiss(e.arguments||[]);break;case"wispbit.remember":await this.handleRemember(e.arguments||[]);break;case"wispbit.getDismissals":return await this.handleGetDismissals(e.arguments||[]);case"wispbit.undismiss":await this.handleUndismiss(e.arguments||[]);break;default:this.connection.console.log(`Unknown command: ${e.command}`)}}),this.connection.onShutdown(async()=>{await this.shutdown()})}shutdown(){this.cleanupProgress()}start(){this.documentManager.listen(this.connection,{onDidChangeContent:(e,n,r)=>{this.handleDocumentChangesWithRanges(e,r)},onDidSave:e=>{this.connection.console.log(`Document saved: ${e}, running lint...`),this.lintDocument(e)}}),this.connection.listen(),this.connection.console.log("Wispbit LSP server started and listening")}};function _1e(t,e){new GF(t,e).start()}import{stripVTControlCharacters as w1e}from"node:util";import oM from"node:process";import p1e from"node:process";import nM from"node:process";var oSt=(t,e,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let i=Object.getOwnPropertyDescriptor(t,n),o=Object.getOwnPropertyDescriptor(e,n);!sSt(i,o)&&r||Object.defineProperty(t,n,o)},sSt=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},aSt=(t,e)=>{let n=Object.getPrototypeOf(e);n!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,n)},cSt=(t,e)=>`/* Wrapped ${t}*/
|
|
259
259
|
${e}`,uSt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),lSt=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),_St=(t,e,n)=>{let r=n===""?"":`with ${n.trim()}() `,i=cSt.bind(null,r,e.toString());Object.defineProperty(i,"name",lSt);let{writable:o,enumerable:s,configurable:a}=uSt;Object.defineProperty(t,"toString",{value:i,writable:o,enumerable:s,configurable:a})};function BF(t,e,{ignoreNonConfigurable:n=!1}={}){let{name:r}=t;for(let i of Reflect.ownKeys(e))oSt(t,e,i,n);return aSt(t,e),_St(t,e,r),t}var QI=new WeakMap,E1e=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let n,r=0,i=t.displayName||t.name||"<anonymous>",o=function(...s){if(QI.set(o,++r),r===1)n=t.apply(this,s),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return n};return BF(o,t),QI.set(o,r),o};E1e.callCount=t=>{if(!QI.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return QI.get(t)};var T1e=E1e;var Ml=[];Ml.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ml.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ml.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var eM=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",FF=Symbol.for("signal-exit emitter"),$F=globalThis,ESt=Object.defineProperty.bind(Object),kF=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if($F[FF])return $F[FF];ESt($F,FF,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){let r=this.listeners[e],i=r.indexOf(n);i!==-1&&(i===0&&r.length===1?r.length=0:r.splice(i,1))}emit(e,n,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let o of this.listeners[e])i=o(n,r)===!0||i;return e==="exit"&&(i=this.emit("afterExit",n,r)||i),i}},tM=class{},TSt=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}}),YF=class extends tM{onExit(){return()=>{}}load(){}unload(){}},HF=class extends tM{#t=jF.platform==="win32"?"SIGINT":"SIGHUP";#n=new kF;#e;#o;#l;#E={};#a=!1;constructor(e){super(),this.#e=e,this.#E={};for(let n of Ml)this.#E[n]=()=>{let r=this.#e.listeners(n),{count:i}=this.#n,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),r.length===i){this.unload();let s=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#t:n;s||e.kill(e.pid,a)}};this.#l=e.reallyExit,this.#o=e.emit}onExit(e,n){if(!eM(this.#e))return()=>{};this.#a===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,e),()=>{this.#n.removeListener(r,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#a){this.#a=!0,this.#n.count+=1;for(let e of Ml)try{let n=this.#E[e];n&&this.#e.on(e,n)}catch{}this.#e.emit=(e,...n)=>this.#i(e,...n),this.#e.reallyExit=e=>this.#u(e)}}unload(){this.#a&&(this.#a=!1,Ml.forEach(e=>{let n=this.#E[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,n)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#l,this.#n.count-=1)}#u(e){return eM(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#l.call(this.#e,this.#e.exitCode)):0}#i(e,...n){let r=this.#o;if(e==="exit"&&eM(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let i=r.call(this.#e,e,...n);return this.#n.emit("exit",this.#e.exitCode,null),i}else return r.call(this.#e,e,...n)}},jF=globalThis.process,{onExit:S1e,load:ZKt,unload:XKt}=TSt(eM(jF)?new HF(jF):new YF);var d1e=nM.stderr.isTTY?nM.stderr:nM.stdout.isTTY?nM.stdout:void 0,SSt=d1e?T1e(()=>{S1e(()=>{d1e.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},f1e=SSt;var rM=!1,zT={};zT.show=(t=p1e.stderr)=>{t.isTTY&&(rM=!1,t.write("\x1B[?25h"))};zT.hide=(t=p1e.stderr)=>{t.isTTY&&(f1e(),rM=!0,t.write("\x1B[?25l"))};zT.toggle=(t,e)=>{t!==void 0&&(rM=t),rM?zT.show(e):zT.hide(e)};var WF=zT;var KF={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots14:{interval:80,frames:["\u2809\u2809","\u2808\u2819","\u2800\u2839","\u2800\u28B8","\u2800\u28F0","\u2880\u28E0","\u28C0\u28C0","\u28C4\u2840","\u28C6\u2800","\u2847\u2800","\u280F\u2800","\u280B\u2801"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},dotsCircle:{interval:80,frames:["\u288E ","\u280E\u2801","\u280A\u2811","\u2808\u2831"," \u2871","\u2880\u2870","\u2884\u2860","\u2886\u2840"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},rollingLine:{interval:80,frames:["/ "," - "," \\ "," |"," |"," \\ "," - ","/ "]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u{1F497} "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}};var oA=KF,c4t=Object.keys(KF);var Dl={};ii(Dl,{error:()=>RSt,info:()=>ASt,success:()=>hSt,warning:()=>mSt});import fSt from"node:tty";var pSt=fSt?.WriteStream?.prototype?.hasColors?.()??!1,nt=(t,e)=>{if(!pSt)return i=>i;let n=`\x1B[${t}m`,r=`\x1B[${e}m`;return i=>{let o=i+"",s=o.indexOf(r);if(s===-1)return n+o+r;let a=n,c=0;for(;s!==-1;)a+=o.slice(c,s)+n,c=s+r.length,s=o.indexOf(r,c);return a+=o.slice(c)+r,a}},_4t=nt(0,0),E4t=nt(1,22),T4t=nt(2,22),S4t=nt(3,23),d4t=nt(4,24),f4t=nt(53,55),p4t=nt(7,27),A4t=nt(8,28),h4t=nt(9,29),m4t=nt(30,39),A1e=nt(31,39),h1e=nt(32,39),m1e=nt(33,39),R1e=nt(34,39),R4t=nt(35,39),g4t=nt(36,39),O4t=nt(37,39),N4t=nt(90,39),C4t=nt(40,49),I4t=nt(41,49),M4t=nt(42,49),D4t=nt(43,49),P4t=nt(44,49),L4t=nt(45,49),y4t=nt(46,49),v4t=nt(47,49),b4t=nt(100,49),U4t=nt(91,39),w4t=nt(92,39),x4t=nt(93,39),V4t=nt(94,39),G4t=nt(95,39),B4t=nt(96,39),F4t=nt(97,39),$4t=nt(101,49),k4t=nt(102,49),Y4t=nt(103,49),H4t=nt(104,49),j4t=nt(105,49),W4t=nt(106,49),K4t=nt(107,49);import g1e from"node:process";function sA(){let{env:t}=g1e,{TERM:e,TERM_PROGRAM:n}=t;return g1e.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var iM=sA(),ASt=R1e(iM?"\u2139":"i"),hSt=h1e(iM?"\u2714":"\u221A"),mSt=m1e(iM?"\u26A0":"\u203C"),RSt=A1e(iM?"\u2716":"\xD7");function qF({onlyFirst:t=!1}={}){let n=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(n,t?void 0:"g")}var gSt=qF();function zF(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(gSt,"")}var b1e=_e(v1e(),1);function JF({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import fs from"node:process";var MSt=3,QF=class{#t=0;start(){this.#t++,this.#t===1&&this.#n()}stop(){if(this.#t<=0)throw new Error("`stop` called more times than `start`");this.#t--,this.#t===0&&this.#e()}#n(){fs.platform==="win32"||!fs.stdin.isTTY||(fs.stdin.setRawMode(!0),fs.stdin.on("data",this.#o),fs.stdin.resume())}#e(){fs.stdin.isTTY&&(fs.stdin.off("data",this.#o),fs.stdin.pause(),fs.stdin.setRawMode(!1))}#o(e){e[0]===MSt&&fs.emit("SIGINT")}},DSt=new QF,e$=DSt;var t$=class{#t=0;#n=!1;#e=0;#o=-1;#l=0;#E=0;#a;#u;#i;#r;#s;#S;#T;#_;#f;#d;#p;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#a={color:"cyan",stream:oM.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#a.color,this.spinner=this.#a.spinner,this.#s=this.#a.interval,this.#i=this.#a.stream,this.#S=typeof this.#a.isEnabled=="boolean"?this.#a.isEnabled:JF({stream:this.#i}),this.#T=typeof this.#a.isSilent=="boolean"?this.#a.isSilent:!1,this.text=this.#a.text,this.prefixText=this.#a.prefixText,this.suffixText=this.#a.suffixText,this.indent=this.#a.indent,oM.env.NODE_ENV==="test"&&(this._stream=this.#i,this._isEnabled=this.#S,Object.defineProperty(this,"_linesToClear",{get(){return this.#t},set(n){this.#t=n}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#o}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#_}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#_=e,this.#A()}get interval(){return this.#s??this.#u.interval??100}get spinner(){return this.#u}set spinner(e){if(this.#o=-1,this.#s=void 0,typeof e=="object"){if(!Array.isArray(e.frames)||e.frames.length===0||e.frames.some(n=>typeof n!="string"))throw new Error("The given spinner must have a non-empty `frames` array of strings");if(e.interval!==void 0&&!(Number.isInteger(e.interval)&&e.interval>0))throw new Error("`spinner.interval` must be a positive integer if provided");this.#u=e}else if(!sA())this.#u=oA.line;else if(e===void 0)this.#u=oA.dots;else if(e!=="default"&&oA[e])this.#u=oA[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#f}set text(e=""){this.#f=e,this.#A()}get prefixText(){return this.#d}set prefixText(e=""){this.#d=e,this.#A()}get suffixText(){return this.#p}set suffixText(e=""){this.#p=e,this.#A()}get isSpinning(){return this.#r!==void 0}#C(e,n,r=!1){let i=typeof e=="function"?e():e;return typeof i=="string"&&i!==""?r?n+i:i+n:""}#g(e=this.#d,n=" "){return this.#C(e,n,!1)}#R(e=this.#p,n=" "){return this.#C(e,n,!0)}#O(e,n){let r=0;for(let i of zF(e).split(`
|
|
260
260
|
`))r+=Math.max(1,Math.ceil((0,b1e.default)(i)/n));return r}#A(){let e=this.#i.columns??80,n=typeof this.#d=="function"?"":this.#d,r=typeof this.#p=="function"?"":this.#p,i=typeof n=="string"&&n!==""?n+" ":"",o=typeof r=="string"&&r!==""?" "+r:"",a=" ".repeat(this.#_)+i+"-"+(typeof this.#f=="string"?" "+this.#f:"")+o;this.#e=this.#O(a,e)}get isEnabled(){return this.#S&&!this.#T}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#S=e}get isSilent(){return this.#T}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#T=e}frame(){let e=Date.now();(this.#o===-1||e-this.#l>=this.interval)&&(this.#o=++this.#o%this.#u.frames.length,this.#l=e);let{frames:n}=this.#u,r=n[this.#o];this.color&&(r=x[this.color](r));let i=this.#g(this.#d," "),o=typeof this.text=="string"?" "+this.text:"",s=this.#R(this.#p," ");return i+r+o+s}clear(){if(!this.#S||!this.#i.isTTY)return this;this.#i.cursorTo(0);for(let e=0;e<this.#t;e++)e>0&&this.#i.moveCursor(0,-1),this.#i.clearLine(1);return(this.#_||this.#E!==this.#_)&&this.#i.cursorTo(this.#_),this.#E=this.#_,this.#t=0,this}render(){if(!this.#S||this.#T)return this;this.clear();let e=this.frame(),n=this.#i.columns??80,r=this.#O(e,n),i=this.#i.rows;if(i&&i>1&&r>i){let o=e.split(`
|
|
261
261
|
`),s=i-1;e=[...o.slice(0,s),"... (content truncated to fit terminal)"].join(`
|
|
@@ -396,7 +396,7 @@ Global options:
|
|
|
396
396
|
--repo-url <url> Override repository URL (default: from git remote)
|
|
397
397
|
-v, --version Show version number
|
|
398
398
|
-h, --help Show help
|
|
399
|
-
`,{importMeta:import.meta,flags:{rule:{type:"string"},file:{type:"string"},json:{type:"string"},include:{type:"string"},repoUrl:{type:"string"},debug:{type:"boolean",shortFlag:"d",default:!1},workspace:{type:"string"},lspClientVersion:{type:"string"},lspClientPackage:{type:"string"},validate:{type:"boolean",default:!1},version:{type:"boolean",shortFlag:"v"},help:{type:"boolean",shortFlag:"h"}},version:cs()});async function i$(t){let e=new us({repositoryUrl:t.repoUrl}),n=await s$(e),{ruleId:r,json:i,mode:o,filePath:s}=t,{commitSelector:a,diffInclude:c}=t;if(o==="diff"){let F=e.getWorkspaceRoot();if(a)c||(c=(await lp(F)).include);else{let Y=await lp(F);a=Y.commitSelector,c||(c=Y.include)}}if(o==="diff"&&a&&c){let F=e.getWorkspaceRoot(),Y=await YV(F),oe=HV(a,c,Y);oe&&(console.error(x.red(oe)),process.exit(1))}let u=!1,l="pretty";i!==void 0?(u=!0,typeof i=="string"?i==="stream"?l="stream":i==="compact"?l="compact":l="pretty":l="pretty"):await FSt();let E,T=new na(n,e);if(r?E=[await T.loadRuleById(r)]:E=await T.loadAllRules(),!u){let F=n.getContext(),Y=F?.organization_name||"",oe=F?.repository_owner||"",X=F?.repository_name||"",te=Y&&oe&&X?x.dim(` {${Y}:${oe}/${X}}`):"";if(o==="check"){let Q=x.bgHex("#eab308").black(" CHECK "),W=x.dim(` (${s||"all files"})`);console.log(`${Q}${W}${te}`)}else{let Q=x.bgHex("#4a90e2").black(" DIFF "),W=(a||"").replace(/\b[0-9a-f]{30,}\b/gi,ce=>ce.substring(0,7)),ue=s?x.dim(` (${s})`):"",pe=c?` ${W} ${x.dim(`[${c.join("/")}]`)}`:` ${W}`;console.log(`${Q}${pe}${ue}${te}`)}}let S=new Xr;if(o==="check")S.setExecutionMode("check",{filePath:s});else{let F=c?c.join(", "):"all";S.setExecutionMode("diff",{baseCommit:a||"",headCommit:F})}let d=new Map(E.map(F=>[F.id,{message:F.message,severity:F.severity,internalId:F.internalId,execution:F.execution}])),p=!t.json&&!u?B1e(S,t.debug||!1,!0,d):void 0,f=Date.now(),N=new Gc(n,e,S),O=0,g=[];S.on("files:discovery:complete",F=>{O=F.totalFiles}),S.on("rules:rule-error",F=>{let Y=E.find(oe=>oe.id===F.ruleId);Y&&(g.push({ruleId:F.ruleId,internalId:Y.internalId,message:F.message,severity:F.severity,error:F.error}),EA()&&Gr(F.error,{tags:{source:"rule-execution",ruleId:F.ruleId,severity:F.severity},extra:{message:F.message,internalId:Y.internalId}}))});let C=await N.execute(E,{mode:o,filePath:s,diffOptions:o==="diff"?{include:c,commitSelector:a,skipPreExistingViolations:n.getSkipPreExistingViolationsEnabled()}:void 0,emitErrors:!0}),M=[];for(let F of C){let Y=E.find(oe=>oe.id===F.ruleId);if(Y){let te={ruleId:F.ruleId,internalId:Y.internalId,message:Y.message,severity:Y.severity,execution:Y.execution,matches:F.matches,llmCost:void 0,llmTokens:void 0};M.push(te)}}if(p?.(),u)G1e(M,l,g);else{let F=M.filter(ce=>ce.severity==="violation"),Y=M.filter(ce=>ce.severity==="suggestion"),oe=F.reduce((ce,ge)=>ce+ge.matches.length,0),X=Y.reduce((ce,ge)=>ce+ge.matches.length,0),te=oe+X,Q=M.filter(ce=>ce.llmCost).reduce((ce,ge)=>ce.plus(new Mr(ge.llmCost||0)),new Mr(0)),W=M.filter(ce=>ce.llmTokens).reduce((ce,ge)=>ce+(ge.llmTokens||0),0),ue;if(o==="check")ue={mode:"check",filePath:s};else{let ce=(a||"").replace(/\b[0-9a-f]{30,}\b/gi,de=>de.substring(0,7)),ge=c?c.join(", "):"all";ue={mode:"diff",baseCommit:ce,headCommit:ge}}let pe=Date.now()-f;x1e(M,{totalRules:E.length,violationCount:oe,suggestionCount:X,totalMatches:te,totalLLMCost:Q.toString(),totalLLMTokens:W,executionMode:ue,executionTime:pe,totalFiles:O,ruleErrors:g,debugMode:t.debug})}return M}async function $St(t){let e=new us({repositoryUrl:t}),n=await s$(e),i=await new na(n,e).loadAllRules();V1e(i)}async function kSt(){let t=process.env.WISPBIT_API_KEY;t||(console.error("WISPBIT_API_KEY environment variable required"),process.exit(1));let e=ut.flags.workspace||process.cwd(),n=ut.flags.lspClientVersion,r=ut.flags.lspClientPackage,i=ut.flags.validate,o=new us({workspaceRoot:e});if(!await o.getRepositoryUrl())throw new Error("No git repository found.");let a=n&&r?{version:n,package:r}:void 0,c=await Lc.initialize(o,{apiKey:t,lspClient:a});if("failed"in c&&(i&&(console.log(JSON.stringify({valid:!1,error:c.error})),process.exit(1)),console.error(`Authentication failed: ${c.error}`),process.exit(1)),i){let u=c.getContext();console.log(JSON.stringify({valid:!0,organizationId:u?.organization_id,organizationName:u?.organization_name,repositoryId:u?.repository_id,repositoryUrl:u?.repository_url,repositoryOwner:u?.repository_owner,repositoryName:u?.repository_name})),process.exit(0)}await _1e(c,o)}async function YSt(t){let e=new us({repositoryUrl:t});await s$(e,{force:!0})}function HSt(){return new Promise((t,e)=>{let n="";process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{n+=r}),process.stdin.on("end",()=>{t(n)}),process.stdin.on("error",e)})}async function jSt(){let t=ut.input[0],e=ut.input[1],n=ut.flags.debug;switch(n&&Co.enable(),t){case"check":{let r=ut.flags.file||ut.input[1];await i$({ruleId:ut.flags.rule,json:ut.flags.json,debug:ut.flags.debug,mode:"check",filePath:r,repoUrl:ut.flags.repoUrl});break}case"diff":{let r;if(ut.flags.include){let s=ut.flags.include.split(",").map(u=>u.trim()),a=["committed","staged","unstaged","untracked"],c=s.filter(u=>!a.includes(u));c.length>0&&(console.error(x.red(`Invalid include(s): ${c.join(", ")}. Valid includes: ${a.join(", ")}`)),process.exit(1)),r=s}let i=ut.input[1];await i$({ruleId:ut.flags.rule,json:ut.flags.json,debug:ut.flags.debug,mode:"diff",filePath:ut.flags.file,diffInclude:r,commitSelector:i,repoUrl:ut.flags.repoUrl});break}case"list":{await $St(ut.flags.repoUrl);break}case"setup":{await YSt(ut.flags.repoUrl);break}case"cache":{if(e==="purge"){let r=new us({repositoryUrl:ut.flags.repoUrl}),o=await new yN(r).purgeCache();console.log(`
|
|
399
|
+
`,{importMeta:import.meta,flags:{rule:{type:"string"},file:{type:"string"},json:{type:"string"},include:{type:"string"},repoUrl:{type:"string"},debug:{type:"boolean",shortFlag:"d",default:!1},workspace:{type:"string"},lspClientVersion:{type:"string"},lspClientPackage:{type:"string"},validate:{type:"boolean",default:!1},version:{type:"boolean",shortFlag:"v"},help:{type:"boolean",shortFlag:"h"}},version:cs()});async function i$(t){let e=new us({repositoryUrl:t.repoUrl}),n=await s$(e),{ruleId:r,json:i,mode:o,filePath:s}=t,{commitSelector:a,diffInclude:c}=t;if(o==="diff"){let F=e.getWorkspaceRoot();if(a)c||(c=(await lp(F)).include);else{let Y=await lp(F);a=Y.commitSelector,c||(c=Y.include)}}if(o==="diff"&&a&&c){let F=e.getWorkspaceRoot(),Y=await YV(F),oe=HV(a,c,Y);oe&&(console.error(x.red(oe)),process.exit(1))}let u=!1,l="pretty";i!==void 0?(u=!0,typeof i=="string"?i==="stream"?l="stream":i==="compact"?l="compact":l="pretty":l="pretty"):await FSt();let E,T=new na(n,e);if(r?E=[await T.loadRuleById(r)]:E=await T.loadAllRules(),!u){let F=n.getContext(),Y=F?.organization_name||"",oe=F?.repository_owner||"",X=F?.repository_name||"",te=Y&&oe&&X?x.dim(` {${Y}:${oe}/${X}}`):"";if(o==="check"){let Q=x.bgHex("#eab308").black(" CHECK "),W=x.dim(` (${s||"all files"})`);console.log(`${Q}${W}${te}`)}else{let Q=x.bgHex("#4a90e2").black(" DIFF "),W=(a||"").replace(/\b[0-9a-f]{30,}\b/gi,ce=>ce.substring(0,7)),ue=s?x.dim(` (${s})`):"",pe=c?` ${W} ${x.dim(`[${c.join("/")}]`)}`:` ${W}`;console.log(`${Q}${pe}${ue}${te}`)}}let S=new Xr;if(o==="check")S.setExecutionMode("check",{filePath:s});else{let F=c?c.join(", "):"all";S.setExecutionMode("diff",{baseCommit:a||"",headCommit:F})}let d=new Map(E.map(F=>[F.id,{message:F.message,severity:F.severity,internalId:F.internalId,execution:F.execution}])),p=!t.json&&!u?B1e(S,t.debug||!1,!0,d):void 0,f=Date.now(),N=new Gc(n,e,S),O=0,g=[];S.on("files:discovery:complete",F=>{O=F.totalFiles}),S.on("rules:rule-error",F=>{let Y=E.find(oe=>oe.id===F.ruleId);Y&&(g.push({ruleId:F.ruleId,internalId:Y.internalId,message:F.message,severity:F.severity,error:F.error}),EA()&&Gr(F.error,{tags:{source:"rule-execution",ruleId:F.ruleId,severity:F.severity},extra:{message:F.message,internalId:Y.internalId}}))});let C=await N.execute(E,{mode:o,filePath:s,diffOptions:o==="diff"?{include:c,commitSelector:a,skipPreExistingViolations:n.getSkipPreExistingViolationsEnabled()}:void 0,emitErrors:!0}),M=[];for(let F of C){let Y=E.find(oe=>oe.id===F.ruleId);if(Y){let te={ruleId:F.ruleId,internalId:Y.internalId,message:Y.message,severity:Y.severity,execution:Y.execution,matches:F.matches,llmCost:void 0,llmTokens:void 0};M.push(te)}}if(p?.(),u)G1e(M,l,g);else{let F=M.filter(ce=>ce.severity==="violation"),Y=M.filter(ce=>ce.severity==="suggestion"),oe=F.reduce((ce,ge)=>ce+ge.matches.length,0),X=Y.reduce((ce,ge)=>ce+ge.matches.length,0),te=oe+X,Q=M.filter(ce=>ce.llmCost).reduce((ce,ge)=>ce.plus(new Mr(ge.llmCost||0)),new Mr(0)),W=M.filter(ce=>ce.llmTokens).reduce((ce,ge)=>ce+(ge.llmTokens||0),0),ue;if(o==="check")ue={mode:"check",filePath:s};else{let ce=(a||"").replace(/\b[0-9a-f]{30,}\b/gi,de=>de.substring(0,7)),ge=c?c.join(", "):"all";ue={mode:"diff",baseCommit:ce,headCommit:ge}}let pe=Date.now()-f;x1e(M,{totalRules:E.length,violationCount:oe,suggestionCount:X,totalMatches:te,totalLLMCost:Q.toString(),totalLLMTokens:W,executionMode:ue,executionTime:pe,totalFiles:O,ruleErrors:g,debugMode:t.debug})}return M}async function $St(t){let e=new us({repositoryUrl:t}),n=await s$(e),i=await new na(n,e).loadAllRules();V1e(i)}async function kSt(){let t=process.env.WISPBIT_API_KEY;t||(console.error("WISPBIT_API_KEY environment variable required"),process.exit(1));let e=ut.flags.workspace||process.cwd(),n=ut.flags.lspClientVersion,r=ut.flags.lspClientPackage,i=ut.flags.validate,o=new us({workspaceRoot:e});if(!await o.getRepositoryUrl())throw new Error("No git repository found.");let a=n&&r?{version:n,package:r}:void 0,c=await Lc.initialize(o,{apiKey:t,lspClient:a});if("failed"in c&&(i&&(console.log(JSON.stringify({valid:!1,error:c.error})),process.exit(1)),console.error(`Authentication failed: ${c.error}`),process.exit(1)),i){let u=c.getContext(),l="https://app.wispbit.com/setup/cli";r&&r.includes("vscode")&&(l="https://app.wispbit.com/setup/vscode"),console.log(JSON.stringify({valid:!0,organizationId:u?.organization_id,organizationName:u?.organization_name,repositoryId:u?.repository_id,repositoryUrl:u?.repository_url,repositoryOwner:u?.repository_owner,repositoryName:u?.repository_name,setupUrl:l})),process.exit(0)}await _1e(c,o)}async function YSt(t){let e=new us({repositoryUrl:t});await s$(e,{force:!0})}function HSt(){return new Promise((t,e)=>{let n="";process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{n+=r}),process.stdin.on("end",()=>{t(n)}),process.stdin.on("error",e)})}async function jSt(){let t=ut.input[0],e=ut.input[1],n=ut.flags.debug;switch(n&&Co.enable(),t){case"check":{let r=ut.flags.file||ut.input[1];await i$({ruleId:ut.flags.rule,json:ut.flags.json,debug:ut.flags.debug,mode:"check",filePath:r,repoUrl:ut.flags.repoUrl});break}case"diff":{let r;if(ut.flags.include){let s=ut.flags.include.split(",").map(u=>u.trim()),a=["committed","staged","unstaged","untracked"],c=s.filter(u=>!a.includes(u));c.length>0&&(console.error(x.red(`Invalid include(s): ${c.join(", ")}. Valid includes: ${a.join(", ")}`)),process.exit(1)),r=s}let i=ut.input[1];await i$({ruleId:ut.flags.rule,json:ut.flags.json,debug:ut.flags.debug,mode:"diff",filePath:ut.flags.file,diffInclude:r,commitSelector:i,repoUrl:ut.flags.repoUrl});break}case"list":{await $St(ut.flags.repoUrl);break}case"setup":{await YSt(ut.flags.repoUrl);break}case"cache":{if(e==="purge"){let r=new us({repositoryUrl:ut.flags.repoUrl}),o=await new yN(r).purgeCache();console.log(`
|
|
400
400
|
${x.green("Cache purged successfully.")} Removed ${o.deletedCount} item(s).`)}else console.error(x.red("Unknown cache subcommand:"),e),ut.showHelp(),process.exit(1);break}case"hooks":{let r=e;r||(console.error(x.red("Provider is required. Supported providers:"),bUe().join(", ")),process.exit(1));let o=NC(r).generateConfig(),s;r==="cursor"?s=Pl.join(process.cwd(),".cursor","hooks.json"):s=Pl.join(process.cwd(),`.${r}`,"hooks.json"),await _a.mkdir(Pl.dirname(s),{recursive:!0}),await _a.writeFile(s,JSON.stringify(o,null,2)),console.log(x.green(`\u2713 Hooks configuration written to ${s}`)),console.log(x.dim(`
|
|
401
401
|
The following hooks are configured:`));for(let[a,c]of Object.entries(o.hooks))for(let u of c)console.log(x.dim(` ${a}: ${u.command}`));break}case"handle-hooks":{let r=e;(!r||!r.includes("."))&&(console.error(x.red("Invalid format. Expected: provider.event (e.g., cursor.afterFileEdit)")),process.exit(1));let i=await HSt();await Co.log(`[handle-hooks] Input: ${i}`);let o=JSON.parse(i),s=await wUe(r,o);await Co.log(`[handle-hooks] Output: ${JSON.stringify(s)}`),console.log(JSON.stringify(s));break}case"server":{await kSt();break}default:{let r;if(ut.flags.include){let s=ut.flags.include.split(",").map(u=>u.trim()),a=["committed","staged","unstaged","untracked"],c=s.filter(u=>!a.includes(u));c.length>0&&(console.error(x.red(`Invalid include(s): ${c.join(", ")}. Valid includes: ${a.join(", ")}`)),process.exit(1)),r=s}let i=ut.input[0];await i$({ruleId:ut.flags.rule,json:ut.flags.json,debug:ut.flags.debug,mode:"diff",filePath:ut.flags.file,diffInclude:r,commitSelector:i,repoUrl:ut.flags.repoUrl});break}}return n}jSt().catch(t=>{Gr(t,{tags:{source:"cli"}}),ut.flags.debug?console.error(t):console.error(x.red("Error:"),t.message||String(t)),YA(2e3).then(()=>{process.exit(1)})});export{FSt as checkForUpdates,x1 as loadApiKey};
|
|
402
402
|
/*! Bundled license information:
|