MCPcopy Create free account
hub / github.com/Railly/agentfiles / saveToVault

Method saveToVault

main.js:29–29  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

27`)}function Sc(a){return a?new Date(a).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}var Jt=class{containerEl;store;app;vaultPath;currentItem=null;selectedMessages=new Set;visibleCount=20;renderComponent=new z.Component;constructor(e,t,s,i){this.containerEl=e,this.store=t,this.app=s,this.vaultPath=i}show(e){this.currentItem=e,this.selectedMessages.clear(),this.visibleCount=20,this.render()}clear(){this.currentItem=null,this.containerEl.empty(),this.containerEl.addClass("as-detail");let e=this.containerEl.createDiv("as-detail-empty");(0,z.setIcon)(e.createDiv("as-detail-empty-icon"),"message-circle"),e.createDiv({text:"Select a conversation to view"})}render(){this.containerEl.empty(),this.containerEl.addClass("as-detail");let e=this.currentItem;if(!e)return this.clear();this.renderToolbar(e),this.renderBody(e)}renderToolbar(e){let t=this.containerEl.createDiv("as-detail-toolbar"),s=t.createDiv("as-toolbar-top"),i=s.createDiv("as-toolbar-left"),r=e.title.length>100?e.title.slice(0,100)+"...":e.title;i.createSpan({cls:"as-detail-title",text:r});let n=s.createDiv("as-toolbar-right"),o=n.createEl("button",{cls:"as-toolbar-btn",attr:{"aria-label":"Toggle favorite"}});(0,z.setIcon)(o,e.isFavorite?"star":"star-off"),o.addEventListener("click",()=>{this.store.toggleFavorite(e.uuid),this.render()});let l=n.createEl("button",{cls:"as-toolbar-btn",attr:{"aria-label":"Copy resume command"}});(0,z.setIcon)(l,"terminal"),l.addEventListener("click",()=>{navigator.clipboard.writeText(`claude --resume ${e.uuid}`),new z.Notice("Resume command copied!",3e3)});let O=n.createEl("button",{cls:"as-toolbar-btn as-toolbar-btn-primary",attr:{"aria-label":"Save to vault"}});(0,z.setIcon)(O,"download"),O.addEventListener("click",()=>this.saveToVault(e));let c=t.createDiv("as-detail-meta-bar");c.createSpan({cls:"as-meta-item",text:e.project}),c.createSpan({cls:"as-meta-item",text:`${e.messageCount} messages`}),e.firstTimestamp&&c.createSpan({cls:"as-meta-item",text:new Date(e.firstTimestamp).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})});let d=[...e.tags,...e.customTags];if(d.length>0){let p=t.createDiv("as-conv-detail-tags");for(let g of d){let f=e.customTags.includes(g),w=p.createSpan({cls:`as-conv-tag ${f?"as-conv-tag-custom":""}`,text:g});if(f){let P=w.createSpan("as-conv-tag-remove");(0,z.setIcon)(P,"x"),P.addEventListener("click",Z=>{Z.stopPropagation(),this.store.removeCustomTag(e.uuid,g),this.render()})}}let u=p.createSpan("as-conv-tag as-conv-tag-add");(0,z.setIcon)(u,"plus"),u.addEventListener("click",()=>this.promptAddTag(e))}}renderBody(e){let t=this.containerEl.createDiv("as-detail-body");if(this.selectedMessages.size>0){let l=t.createDiv("as-conv-selection-bar");l.createSpan({text:`${this.selectedMessages.size} message${this.selectedMessages.size>1?"s":""} selected`}),l.createEl("button",{cls:"as-conv-save-selected-btn",text:"Save selected to vault"}).addEventListener("click",()=>this.saveToVault(e))}let s=20,i=e.messages.length,r=e.messages.slice(0,this.visibleCount);for(let l=0;l<r.length;l++)this.renderMessage(t,r[l],l);if(this.visibleCount<i){let l=i-this.visibleCount,O=Math.min(s,l),c=t.createDiv("as-conv-show-more");c.createEl("button",{text:`Show next ${O} messages`,cls:"as-conv-show-more-btn"}).addEventListener("click",()=>{this.visibleCount+=s,this.render()}),c.createEl("button",{text:`Show all ${i} messages`,cls:"as-conv-show-all-btn"}).addEventListener("click",()=>{this.visibleCount=i,this.render()})}let n=t.createDiv("as-conv-resume-section");n.createDiv({cls:"as-section-title",text:"Resume this conversation"}),n.createEl("code",{cls:"as-conv-resume-cmd",text:`claude --resume ${e.uuid}`}).addEventListener("click",()=>{navigator.clipboard.writeText(`claude --resume ${e.uuid}`),new z.Notice("Copied!",2e3)})}renderMessage(e,t,s){let i=t.role==="human",r=e.createDiv(`as-conv-msg ${i?"as-conv-msg-human":"as-conv-msg-assistant"}`);this.selectedMessages.has(s)&&r.addClass("as-conv-msg-selected");let n=r.createDiv("as-conv-msg-header"),o=n.createSpan("as-conv-msg-role-icon");(0,z.setIcon)(o,i?"user":"bot"),n.createSpan({cls:"as-conv-msg-role",text:i?"You":"Claude"}),t.timestamp&&n.createSpan({cls:"as-conv-msg-time",text:Sc(t.timestamp)});let l=n.createSpan("as-conv-msg-select");(0,z.setIcon)(l,this.selectedMessages.has(s)?"check-square":"square"),l.setAttribute("aria-label","Select message for export"),l.addEventListener("click",d=>{d.stopPropagation(),this.selectedMessages.has(s)?this.selectedMessages.delete(s):this.selectedMessages.add(s),this.render()});let O=r.createDiv("as-conv-msg-content"),c=t.text.length>2e3&&!i?t.text.slice(0,2e3)+`
28
29*... (truncated)*`:t.text;if(z.MarkdownRenderer.render(this.app,c,O,"",this.renderComponent),t.toolCalls&&t.toolCalls.length>0){let d=r.createDiv("as-conv-msg-tools"),p=[...new Set(t.toolCalls)];for(let u of p.slice(0,5))d.createSpan({cls:"as-conv-tool-badge",text:u});p.length>5&&d.createSpan({cls:"as-conv-tool-badge",text:`+${p.length-5}`})}}promptAddTag(e){let t=this.containerEl.querySelector(".as-conv-detail-tags");if(!t)return;let s=t.querySelector(".as-conv-tag-add");if(!s)return;let i=createEl("input",{type:"text",placeholder:"Enter tag...",cls:"as-conv-tag-input"});s.replaceWith(i),i.focus();let r=!1,n=()=>{if(r)return;r=!0;let o=i.value.trim().toLowerCase().replace(/\s+/g,"-");o&&this.store.addCustomTag(e.uuid,o),this.render()};i.addEventListener("keydown",o=>{o.key==="Enter"&&n(),o.key==="Escape"&&this.render()}),i.addEventListener("blur",n)}saveToVault(e){if(this.selectedMessages.size===0){new z.Notice("Select messages to export first",3e3);return}let t=Array.from(this.selectedMessages).sort((n,o)=>n-o).map(n=>e.messages[n]).filter(Boolean),s=yn({selectedMessages:t,conversation:e,vaultPath:this.vaultPath}),i=(0,dt.resolve)(Pn(e,this.vaultPath));if(!i.startsWith((0,dt.resolve)(this.vaultPath))){new z.Notice("Invalid path \u2014 cannot save outside vault",5e3);return}let r=(0,dt.dirname)(i);try{(0,Ne.existsSync)(r)||(0,Ne.mkdirSync)(r,{recursive:!0}),(0,Ne.writeFileSync)(i,s,"utf-8"),new z.Notice(`Saved to ${i.split("/").slice(-2).join("/")}`,5e3)}catch(n){new z.Notice(`Failed to save: ${n instanceof Error?n.message:String(n)}`,5e3)}}};var pt="agentfiles-view",Kt=class extends wn.ItemView{store;settings;saveSettings;sidebarPanel;listPanel;detailPanel;dashboardPanel;marketplacePanel;conversationStore=new Ft;convListPanel;convDetailPanel;sidebarEl;listEl;detailEl;dashboardEl;marketplaceEl;convListWrapperEl;convDetailWrapperEl;skillListWrapperEl;skillDetailWrapperEl;resizeHandle1;resizeHandle2;isDashboard=!1;isMarketplace=!1;isConversations=!1;updateRef=null;convUpdateRef=null;dragCleanup=null;constructor(e,t,s,i){super(e),this.store=t,this.settings=s,this.saveSettings=i}getViewType(){return pt}getDisplayText(){return"Agentfiles"}getIcon(){return"cpu"}async onOpen(){let e=this.contentEl;e.empty(),e.addClass("as-container"),this.sidebarEl=e.createDiv("as-panel as-panel-sidebar"),this.resizeHandle1=this.createResizeHandle(e,this.sidebarEl,"--as-sidebar-width",120,400),this.listEl=e.createDiv("as-panel as-panel-list"),this.resizeHandle2=this.createResizeHandle(e,this.listEl,"--as-list-width",180,600),this.detailEl=e.createDiv("as-panel as-panel-detail"),this.dashboardEl=e.createDiv("as-panel as-panel-dashboard as-hidden"),this.marketplaceEl=e.createDiv("as-panel as-panel-marketplace as-hidden"),this.skillListWrapperEl=this.listEl.createDiv("as-wrapper"),this.convListWrapperEl=this.listEl.createDiv("as-wrapper as-hidden"),this.skillDetailWrapperEl=this.detailEl.createDiv("as-wrapper"),this.convDetailWrapperEl=this.detailEl.createDiv("as-wrapper as-hidden");let t=this.app.vault.adapter.getBasePath?.()||"";this.sidebarPanel=new ft(this.sidebarEl,this.store,()=>this.toggleDashboard(),()=>this.toggleMarketplace(),()=>this.openCreateModal(),()=>this.toggleConversations(),this.conversationStore),this.listPanel=new gt(this.skillListWrapperEl,this.store,s=>this.onSelectItem(s)),this.detailPanel=new Yt(this.skillDetailWrapperEl,this.store,this.settings,this.saveSettings,this),this.dashboardPanel=new Mt(this.dashboardEl,this.app),this.marketplacePanel=new Gt(this.marketplaceEl,this,this.settings,()=>{this.store.refresh(this.settings)}),this.convListPanel=new Ht(this.convListWrapperEl,this.conversationStore,s=>this.onSelectConversation(s)),this.convDetailPanel=new Jt(this.convDetailWrapperEl,this.conversationStore,this.app,t),this.updateRef=this.store.on("updated",()=>this.renderAll()),this.convUpdateRef=this.conversationStore.on("conversations-updated",()=>{this.isConversations&&(this.convListPanel.render(),this.sidebarPanel.render())}),this.renderAll(),this.store.revalidate()}hideAllSpecialPanels(){this.listEl.addClass("as-hidden"),this.detailEl.addClass("as-hidden"),this.resizeHandle1.addClass("as-hidden"),this.resizeHandle2.addClass("as-hidden"),this.dashboardEl.addClass("as-hidden"),this.marketplaceEl.addClass("as-hidden")}showDefaultPanels(){this.listEl.removeClass("as-hidden"),this.detailEl.removeClass("as-hidden"),this.resizeHandle1.removeClass("as-hidden"),this.resizeHandle2.removeClass("as-hidden")}showSkillPanels(){this.skillListWrapperEl.removeClass("as-hidden"),this.skillDetailWrapperEl.removeClass("as-hidden"),this.convListWrapperEl.addClass("as-hidden"),this.convDetailWrapperEl.addClass("as-hidden")}showConversationPanels(){this.skillListWrapperEl.addClass("as-hidden"),this.skillDetailWrapperEl.addClass("as-hidden"),this.convListWrapperEl.removeClass("as-hidden"),this.convDetailWrapperEl.removeClass("as-hidden")}toggleDashboard(){this.dragCleanup?.(),this.dragCleanup=null,this.isDashboard=!this.isDashboard,this.isMarketplace=!1,this.isConversations=!1,this.hideAllSpecialPanels(),this.isDashboard?(this.dashboardEl.removeClass("as-hidden"),this.dashboardPanel.render()):(this.showDefaultPanels(),this.showSkillPanels()),this.sidebarPanel.setDashboardActive(this.isDashboard),this.sidebarPanel.setMarketplaceActive(!1),this.sidebarPanel.setConversationsActive(!1),this.sidebarPanel.render()}toggleMarketplace(){this.dragCleanup?.(),this.dragCleanup=null,this.isMarketplace=!this.isMarketplace,this.isDashboard=!1,this.isConversations=!1,this.hideAllSpecialPanels(),this.isMarketplace?(this.marketplaceEl.removeClass("as-hidden"),this.marketplacePanel.render()):(this.showDefaultPanels(),this.showSkillPanels()),this.sidebarPanel.setMarketplaceActive(this.isMarketplace),this.sidebarPanel.setDashboardActive(!1),this.sidebarPanel.setConversationsActive(!1),this.sidebarPanel.render()}toggleConversations(){this.dragCleanup?.(),this.dragCleanup=null,this.isConversations=!this.isConversations,this.isDashboard=!1,this.isMarketplace=!1,this.hideAllSpecialPanels(),this.isConversations?(this.showDefaultPanels(),this.showConversationPanels(),this.conversationStore.refresh(),this.convListPanel.render(),this.convDetailPanel.clear()):(this.showDefaultPanels(),this.showSkillPanels()),this.sidebarPanel.setConversationsActive(this.isConversations),this.sidebarPanel.setDashboardActive(!1),this.sidebarPanel.setMarketplaceActive(!1),this.sidebarPanel.render()}renderAll(){this.sidebarPanel.render(),!this.isDashboard&&!this.isMarketplace&&!this.isConversations&&(this.listPanel.render(),this.store.filteredItems.length||this.detailPanel.clear())}openCreateModal(){new Nt(this.app,e=>{this.store.refresh(this.settings),window.setTimeout(()=>{let t=this.store.allItems.find(s=>s.filePath===e||s.realPath===e);t&&this.onSelectItem(t)},100)}).open()}onSelectItem(e){this.isDashboard&&this.toggleDashboard(),this.isMarketplace&&this.toggleMarketplace(),this.isConversations&&this.toggleConversations(),this.listPanel.setSelected(e.id),this.listPanel.render(),this.detailPanel.show(e)}onSelectConversation(e){this.convListPanel.setSelected(e.uuid),this.convListPanel.render(),this.convDetailPanel.show(e)}createResizeHandle(e,t,s,i,r){let n=e.createDiv("as-resize-handle"),o=0,l=0,O=d=>{let p=Math.min(r,Math.max(i,l+(d.clientX-o)));e.style.setProperty(s,`${p}px`)},c=()=>{n.removeClass("is-dragging"),activeDocument.removeEventListener("mousemove",O),activeDocument.removeEventListener("mouseup",c),this.dragCleanup=null};return n.addEventListener("mousedown",d=>{d.preventDefault(),o=d.clientX,l=parseInt(e.style.getPropertyValue(s))||t.offsetWidth,n.addClass("is-dragging"),activeDocument.addEventListener("mousemove",O),activeDocument.addEventListener("mouseup",c),this.dragCleanup=c}),n}async onClose(){this.dragCleanup?.(),this.updateRef&&this.store.offref(this.updateRef),this.convUpdateRef&&this.conversationStore.offref(this.convUpdateRef)}};var xn=require("obsidian"),ta=require("path"),Be=require("fs"),Zn=require("os");var Ss=(0,ta.join)((0,Zn.homedir)(),".skillkit","enrichment-cache.json");function vc(){if(!(0,Be.existsSync)(Ss))return null;try{return JSON.parse((0,Be.readFileSync)(Ss,"utf-8"))}catch{return null}}function $c(a){try{(0,Be.writeFileSync)(Ss,JSON.stringify(a),"utf-8")}catch{}}var ea=class extends xn.Events{items=new Map;_filter={kind:"all"};_searchQuery="";_deepSearch=!1;_deepSearchScope="both";_projectsHomeDir="";get filter(){return this._filter}get searchQuery(){return this._searchQuery}get deepSearch(){return this._deepSearch}get allItems(){return Array.from(this.items.values())}get filteredItems(){let e=this.allItems;switch(this._filter.kind){case"favorites":e=e.filter(t=>t.isFavorite);break;case"tool":{let t=this._filter.toolId;e=e.filter(s=>s.tools.includes(t));break}case"type":{let t=this._filter.type;e=e.filter(s=>s.type===t);break}case"collection":{let t=this._filter.name;e=e.filter(s=>s.collections.includes(t));break}case"project":{let t=this._filter.project;e=e.filter(s=>os(s.filePath,this._projectsHomeDir)===t);break}}if(this._searchQuery){let t=this._searchQuery.toLowerCase(),s=this._deepSearch&&(this._deepSearchScope==="description"||this._deepSearchScope==="both"),i=this._deepSearch&&(this._deepSearchScope==="content"||this._deepSearchScope==="both");e=e.filter(r=>r.name.toLowerCase().includes(t)||s&&r.description.toLowerCase().includes(t)||i&&r.content.toLowerCase().includes(t))}return e.sort((t,s)=>t.name.localeCompare(s.name))}getItem(e){return this.items.get(e)}get hasSkillkit(){return K()}_enrichGeneration=0;refresh(e){this._projectsHomeDir=e.projectsHomeDir,this.items=cn(e),K()&&this.applyEnrichmentFromCache(),this.trigger("updated")}revalidate(){K()&&this.revalidateAsync()}applyEnrichmentFromCache(){let e=vc();if(!e)return;let t=new Map(Object.entries(e.stats)),s=new Map(Object.entries(e.conflicts));this.applyEnrichment(t,s,e.warnings)}async revalidateAsync(){let e=++this._enrichGeneration,[t,s,i]=await Promise.all([ys(),ws(),xs()]);e===this._enrichGeneration&&(this.applyEnrichment(t,s,i),this.trigger("updated"),$c({stats:Object.fromEntries(t),conflicts:Object.fromEntries(s),warnings:i}))}applyEnrichment(e,t,s){let i=new Set(s.oversized.map(l=>l.name)),r=new Set(s.longDesc.map(l=>l.name)),n=new Map(s.oversized.map(l=>[l.name,l.lines])),o=new Map(s.longDesc.map(l=>[l.name,l.chars]));for(let l of this.items.values()){let O=l.filePath.split(ta.sep).slice(-2,-1)[0],c=l.name.toLowerCase().replace(/\s+/g,"-"),d=e.get(l.name)||e.get(O)||e.get(c);d?(d.isHeavy=l.content.length>5e3,l.usage=d):l.usage={uses:0,lastUsed:null,daysSinceUsed:null,isStale:!0,isHeavy:l.content.length>5e3};let p=l.content.split(`
30`).length,u=l.description.length;l.warnings={oversized:i.has(l.name)||p>500,longDesc:r.has(l.name)||u>1024,lineCount:n.get(l.name)??p,descChars:o.get(l.name)??u},l.conflicts=t.get(l.name)||t.get(O)||[]}}setFilter(e){this._filter=e,this.trigger("updated")}setSearch(e){this._searchQuery=e,this.trigger("updated")}setDeepSearch(e){this._deepSearch!==e&&(this._deepSearch=e,this.trigger("updated"))}setDeepSearchScope(e){this._deepSearchScope!==e&&(this._deepSearchScope=e,this.trigger("updated"))}toggleFavorite(e,t){let s=this.items.get(e);s&&(s.isFavorite=!s.isFavorite,s.isFavorite?t.favorites.includes(e)||t.favorites.push(e):t.favorites=t.favorites.filter(i=>i!==e),this.trigger("updated"))}getToolCounts(){let e=new Map;for(let t of this.items.values())for(let s of t.tools)e.set(s,(e.get(s)||0)+1);return e}getTypeCounts(){let e=new Map;for(let t of this.items.values())e.set(t.type,(e.get(t.type)||0)+1);return e}getProjectCounts(){let e=new Map;for(let t of this.items.values()){let s=os(t.filePath,this._projectsHomeDir);e.set(s,(e.get(s)||0)+1)}return e}};var Tn=require("fs"),aa=class{watchers=[];debounceTimer=null;debounceMs;onChange;constructor(e,t){this.debounceMs=e,this.onChange=t}watchPaths(e){this.close();for(let t of e)try{let s=(0,Tn.watch)(t,{recursive:!0},()=>this.scheduleUpdate());this.watchers.push(s)}catch{}}scheduleUpdate(){this.debounceTimer&&window.clearTimeout(this.debounceTimer),this.debounceTimer=window.setTimeout(()=>{this.debounceTimer=null,this.onChange()},this.debounceMs)}close(){this.debounceTimer&&(window.clearTimeout(this.debounceTimer),this.debounceTimer=null);for(let e of this.watchers)try{e.close()}catch{}this.watchers=[]}};var N=require("obsidian");var sa=class extends N.PluginSettingTab{plugin;constructor(e,t){super(e,t),this.plugin=t}display(){let{containerEl:e}=this;e.empty(),new N.Setting(e).setName("File watching").setDesc("Automatically detect changes to skill files").addToggle(t=>t.setValue(this.plugin.settings.watchEnabled).onChange(async s=>{this.plugin.settings.watchEnabled=s,await this.plugin.saveSettings(),this.plugin.restartWatcher()})),new N.Setting(e).setName("Watch debounce (ms)").setDesc("Delay before re-scanning after file changes").addText(t=>t.setValue(String(this.plugin.settings.watchDebounceMs)).onChange(async s=>{let i=parseInt(s);!isNaN(i)&&i>=100&&(this.plugin.settings.watchDebounceMs=i,await this.plugin.saveSettings())})),new N.Setting(e).setName("Display names").setDesc("How skill and command names are displayed in the list").addDropdown(t=>t.addOptions({auto:"Auto (frontmatter / heading / filename)",filename:"Filename only"}).setValue(this.plugin.settings.namingMode||"auto").onChange(async s=>{this.plugin.settings.namingMode=s,await this.plugin.saveSettings(),this.plugin.refreshStore()})),new N.Setting(e).setName("Deep search by default").setDesc("Enable deep search when the view opens (can always be toggled in the search bar)").addToggle(t=>t.setValue(this.plugin.settings.deepSearchDefault??!1).onChange(async s=>{this.plugin.settings.deepSearchDefault=s,await this.plugin.saveSettings()})),new N.Setting(e).setName("Deep search scope").setDesc("What to include when deep search is enabled").addDropdown(t=>t.addOptions({both:"Description and file content",description:"Description only",content:"File content only"}).setValue(this.plugin.settings.deepSearchScope??"both").onChange(async s=>{this.plugin.settings.deepSearchScope=s,await this.plugin.saveSettings()})),new N.Setting(e).setName("Marketplace").setHeading(),new N.Setting(e).setName("Package runner").setDesc("Command used to install skills from the marketplace").addDropdown(t=>t.addOptions({auto:"Auto-detect",npx:"npx",bunx:"bunx"}).setValue(this.plugin.settings.packageRunner).onChange(async s=>{this.plugin.settings.packageRunner=s,await this.plugin.saveSettings()})),new N.Setting(e).setName("Project scanning").setHeading(),new N.Setting(e).setName("Scan projects").setDesc("Scan all directories under the projects home folder for project-level skills").addToggle(t=>t.setValue(this.plugin.settings.projectScanEnabled).onChange(async s=>{this.plugin.settings.projectScanEnabled=s,await this.plugin.saveSettings(),this.plugin.refreshStore(),this.plugin.restartWatcher()})),new N.Setting(e).setName("Projects home directory").setDesc("Root directory to scan for project-level skills. Leave empty for home directory (~).").addText(t=>t.setPlaceholder("~").setValue(this.plugin.settings.projectsHomeDir).onChange(async s=>{this.plugin.settings.projectsHomeDir=s,await this.plugin.saveSettings(),this.plugin.refreshStore(),this.plugin.restartWatcher()})),new N.Setting(e).setName("Tools").setHeading();for(let t of W){let s=t.isInstalled(),i=this.plugin.settings.tools[t.id]||{enabled:!0,customPaths:[]};new N.Setting(e).setName(t.name).setDesc(s?"Installed":"Not detected").addToggle(r=>r.setValue(s&&i.enabled).setDisabled(!s).onChange(async n=>{this.plugin.settings.tools[t.id]={...i,enabled:n},await this.plugin.saveSettings(),this.plugin.refreshStore()}))}}};var ia=class extends Xn.Plugin{settings=us;store=new ea;watcher=null;async onload(){await this.loadSettings(),this.addVaultPath(),this.registerView(pt,e=>new Kt(e,this.store,this.settings,()=>this.saveSettings())),this.addRibbonIcon("cpu","Agentfiles",()=>this.activateView()),this.addCommand({id:"open",name:"Open",callback:()=>this.activateView()}),this.addSettingTab(new sa(this.app,this)),this.store.setDeepSearch(this.settings.deepSearchDefault??!1),this.store.setDeepSearchScope(this.settings.deepSearchScope??"both"),this.app.workspace.onLayoutReady(()=>{this.refreshStore(),this.startWatcher()})}addVaultPath(){let e=this.app.vault.adapter;if(!e.getBasePath)return;let t=e.getBasePath();this.settings.customScanPaths.includes(t)||this.settings.customScanPaths.push(t)}onunload(){this.stopWatcher()}refreshStore(){this.store.refresh(this.settings)}startWatcher(){this.settings.watchEnabled&&(this.watcher=new aa(this.settings.watchDebounceMs,()=>this.refreshStore()),this.watcher.watchPaths(dn(this.settings)))}stopWatcher(){this.watcher&&(this.watcher.close(),this.watcher=null)}restartWatcher(){this.stopWatcher(),this.startWatcher()}async activateView(){let e=this.app.workspace.getLeavesOfType(pt);if(e.length>0){await this.app.workspace.revealLeaf(e[0]);return}let t=this.app.workspace.getLeaf("tab");await t.setViewState({type:pt,active:!0}),await this.app.workspace.revealLeaf(t)}async loadSettings(){let e=await this.loadData();this.settings=Object.assign({},us,e)}async saveSettings(){await this.saveData(this.settings)}};

Callers 2

renderToolbarMethod · 0.45
renderBodyMethod · 0.45

Calls 5

ynFunction · 0.85
PnFunction · 0.85
sliceMethod · 0.80
filterMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected