@compass-ai/nova 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1887,7 +1887,7 @@ ${Yen}
|
|
|
1887
1887
|
Try running with %s or get access `,X.cyan("sudo"))+`
|
|
1888
1888
|
to the local update config store via
|
|
1889
1889
|
`+X.cyan(yze(" sudo chown -R $USER:$(id -gn $USER) %s ",jB));qZ.on("exit",()=>{console.error(zZ(i,{textAlignment:"center"}))})}}check(){!this.config||this.config.get("optOut")||this.#i||(this.update=this.config.get("update"),this.update&&(this.update.current=this.#r,this.config.delete("update")),!(Date.now()-this.config.get("lastUpdateCheck")<this.#n)&&Lsn(qZ.execPath,[pLt.join(Xsn,"check.js"),JSON.stringify(this.#t)],{detached:!0,stdio:"ignore"}).unref())}async fetchInfo(){let{distTag:t}=this.#t,i=await QQe(this._packageName,{version:t});return{latest:i,current:this.#r,type:(0,dLt.default)(this.#r,i)??t,name:this._packageName}}notify(t){let i=!this._shouldNotifyInNpmScript&&_Jt;if(!qZ.stdout.isTTY||i||!this.update||!(0,fLt.default)(this.update.latest,this.update.current))return this;t={isGlobal:SJt,...t};let o=t.isGlobal?`npm i -g ${this._packageName}`:`npm i ${this._packageName}`,l="Update available "+X.dim("{currentVersion}")+X.reset(" \u2192 ")+X.green("{latestVersion}")+`
|
|
1890
|
-
Run `+X.cyan("{updateCommand}")+" to update",p=t.message||l;t.boxenOptions??={padding:1,margin:1,textAlignment:"center",borderColor:"yellow",borderStyle:"round"};let h=zZ(gze(p,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:o}),t.boxenOptions);return t.defer===!1?console.error(h):qZ.on("exit",()=>{console.error(h)}),this}};function bze(n){let t=new vie(n);return t.check(),t}sp();var gLt=Sa(BQe(),1);vre();Ah();Sm();za();import{readFile as Usn}from"fs/promises";import wze from"path";import{fileURLToPath as Qsn}from"url";var mLt="@compass-ai/nova",hLt="
|
|
1890
|
+
Run `+X.cyan("{updateCommand}")+" to update",p=t.message||l;t.boxenOptions??={padding:1,margin:1,textAlignment:"center",borderColor:"yellow",borderStyle:"round"};let h=zZ(gze(p,{packageName:this._packageName,currentVersion:this.update.current,latestVersion:this.update.latest,updateCommand:o}),t.boxenOptions);return t.defer===!1?console.error(h):qZ.on("exit",()=>{console.error(h)}),this}};function bze(n){let t=new vie(n);return t.check(),t}sp();var gLt=Sa(BQe(),1);vre();Ah();Sm();za();import{readFile as Usn}from"fs/promises";import wze from"path";import{fileURLToPath as Qsn}from"url";var mLt="@compass-ai/nova",hLt="1.0.16",_Lt="1.0.0",zsn=Qsn(import.meta.url),qsn=wze.dirname(zsn),Ize=wze.resolve(qsn,"../../package.json"),$sn="update-cache.json",Ksn={checkOnStartup:!0,checkInterval:24,showNotifications:!0,notificationStyle:"banner",includePrerelease:!1},xze=class n{config;cache;cacheFilePath;packageJson;constructor(t,i){this.config=t,this.packageJson=i,this.cacheFilePath=wze.join(Il(),$sn),this.cache={history:[],cacheVersion:_Lt}}static async create(t){let i={...Ksn,...t},o={name:mLt,version:hLt};try{if(J.debug("Update service: resolving package.json",{path:Ize}),await xa(Ize)){let p=await Usn(Ize,"utf-8"),h=JSON.parse(p);o={name:h.name||mLt,version:h.version||hLt},J.debug("Update service: loaded package.json",{name:o.name,version:o.version,source:"package.json"})}else J.debug("Update service: package.json not found, using fallback",{name:o.name,version:o.version,source:"fallback"})}catch(p){J.debug("Update service: failed to read package.json, using fallback",{error:p instanceof Error?p.message:"unknown error",name:o.name,version:o.version})}let l=new n(i,o);return await l.loadCache(),l}async loadCache(){try{if(await fl(Il()),await xa(this.cacheFilePath)){let t=await Bm(this.cacheFilePath);t&&t.cacheVersion===_Lt&&(this.cache=t)}}catch(t){J.debug("Failed to load update cache",t)}}async saveCache(){try{await fl(Il()),await r1(this.cacheFilePath,this.cache)}catch(t){J.debug("Failed to save update cache",t)}}async checkForUpdates(t=!1){let i={updateAvailable:!1,currentVersion:this.packageJson.version,checkedAt:new Date().toISOString()};try{if(!t&&this.cache.lastCheck){let p=new Date(this.cache.lastCheck.checkedAt).getTime(),h=this.config.checkInterval*60*60*1e3;if(Date.now()-p<h)return J.debug("Skipping update check - within interval"),this.cache.lastCheck}J.debug("Checking for updates...");let l=await bze({pkg:this.packageJson,updateCheckInterval:0}).fetchInfo();return l&&l.type&&l.latest!==this.packageJson.version&&(i.updateAvailable=!0,i.latestVersion=l.latest,i.updateType=this.mapUpdateType(l.type),i.releaseNotesUrl=`https://dev.azure.com/oakpeak-devops/Kore/_git/Kore-CLI?version=GTv${l.latest}`,!this.config.includePrerelease&&gLt.default.prerelease(l.latest)&&(i.updateAvailable=!1,i.latestVersion=void 0,i.updateType=void 0)),this.cache.lastCheck=i,await this.saveCache(),i}catch(o){return i.error=o instanceof Error?o.message:"Failed to check for updates",J.debug("Update check failed",o),i}}mapUpdateType(t){switch(t){case"major":return"major";case"minor":return"minor";case"patch":return"patch";case"prerelease":return"prerelease";default:return"patch"}}displayUpdateNotification(t){if(!t.updateAvailable||!t.latestVersion||!this.config.showNotifications||this.config.notificationStyle==="silent")return;let i=this.formatNotification(t);console.log(i),this.updateNotificationState(t.latestVersion)}formatNotification(t){let{currentVersion:i,latestVersion:o,updateType:l}=t;switch(this.config.notificationStyle){case"minimal":return this.formatMinimalNotification(i,o,l);case"detailed":return this.formatDetailedNotification(i,o,l,t.releaseNotesUrl);default:return this.formatBannerNotification(i,o,l)}}formatMinimalNotification(t,i,o){let l=this.getUpdateTypeColor(o);return X.gray(`Update available: ${t} -> `)+l(i)+X.gray(` (npm i -g ${this.packageJson.name})`)}formatBannerNotification(t,i,o){let l=this.getUpdateTypeColor(o),p=o?` (${o})`:"",h=[`Update available! ${X.dim(t)} ${X.reset("\u2192")} ${l(i)}${X.dim(p)}`,"",`Run ${X.cyan(`npm i -g ${this.packageJson.name}`)} to update`].join(`
|
|
1891
1891
|
`);return zZ(h,{padding:1,margin:1,borderStyle:"round",borderColor:this.getUpdateTypeBorderColor(o),title:"Compass CLI Update",titleAlignment:"center"})}formatDetailedNotification(t,i,o,l){let p=this.getUpdateTypeColor(o),h=o?o.charAt(0).toUpperCase()+o.slice(1):"New",I=["",X.bold.cyan(` ${h} Update Available!`),"",` ${X.gray("Current version:")} ${t}`,` ${X.gray("Latest version:")} ${p(i)}`,""];l&&(I.push(` ${X.gray("Release notes:")} ${X.underline.blue(l)}`),I.push("")),I.push(` ${X.gray("To update, run:")} ${X.cyan(`npm i -g ${this.packageJson.name}`)}`),I.push("");let A=I.join(`
|
|
1892
1892
|
`);return zZ(A,{padding:0,margin:1,borderStyle:"double",borderColor:this.getUpdateTypeBorderColor(o)})}getUpdateTypeColor(t){switch(t){case"major":return X.red;case"minor":return X.yellow;case"patch":return X.green;case"prerelease":return X.magenta;default:return X.cyan}}getUpdateTypeBorderColor(t){switch(t){case"major":return"red";case"minor":return"yellow";case"patch":return"green";case"prerelease":return"magenta";default:return"cyan"}}async updateNotificationState(t){let i=this.cache.notificationState;i&&i.version===t?i.showCount++:this.cache.notificationState={version:t,notifiedAt:new Date().toISOString(),dismissed:!1,showCount:1},await this.saveCache()}async dismissNotification(){this.cache.notificationState&&(this.cache.notificationState.dismissed=!0,this.cache.notificationState.dismissedAt=new Date().toISOString(),await this.saveCache())}async performUpdate(t="npm"){let i=await this.checkForUpdates(!0);if(!i.updateAvailable||!i.latestVersion)return J.output(X.green("You are already on the latest version!")),!0;let o=this.packageJson.version,l=i.latestVersion;J.output(""),J.output(X.cyan(`Updating Compass CLI from ${o} to ${l}...`)),J.output("");try{let p=this.getUpdateCommand(t);J.output(X.gray(`Running: ${p}`)),J.output("");let{stdout:h}=await ex(p,{shell:!0});return h&&J.output(h),await this.recordUpdateHistory(o,l,!0,t),J.output(""),J.output(X.green(`Successfully updated to version ${l}!`)),J.output(X.gray("Please restart Compass CLI to use the new version.")),J.output(""),!0}catch(p){let h=p instanceof Error?p.message:"Update failed";return await this.recordUpdateHistory(o,l,!1,t,h),J.output(""),J.output(X.red(`Update failed: ${h}`)),J.output(""),J.output(X.gray("You can try updating manually:")),J.output(X.cyan(` ${this.getUpdateCommand(t)}`)),J.output(""),!1}}getUpdateCommand(t){let i=this.packageJson.name;switch(t){case"yarn":return`yarn global add ${i}`;case"pnpm":return`pnpm add -g ${i}`;default:return`npm install -g ${i}`}}async recordUpdateHistory(t,i,o,l,p){let h={fromVersion:t,toVersion:i,updatedAt:new Date().toISOString(),success:o,method:l,error:p};this.cache.history.push(h),this.cache.history.length>10&&(this.cache.history=this.cache.history.slice(-10)),o&&(this.cache.notificationState=void 0),await this.saveCache()}getUpdateHistory(){return[...this.cache.history]}getLastCheckResult(){return this.cache.lastCheck}getConfig(){return{...this.config}}async updateConfig(t){this.config={...this.config,...t}}getVersionInfo(){return{currentVersion:this.packageJson.version,packageName:this.packageJson.name,lastCheck:this.cache.lastCheck,updateAvailable:this.cache.lastCheck?.updateAvailable??!1,latestVersion:this.cache.lastCheck?.latestVersion}}async detectPackageManager(){try{let{stdout:t}=await ex("yarn",["global","list","--depth=0"],{shell:!0,reject:!1});if(t&&t.includes(this.packageJson.name))return"yarn"}catch{}try{let{stdout:t}=await ex("pnpm",["list","-g","--depth=0"],{shell:!0,reject:!1});if(t&&t.includes(this.packageJson.name))return"pnpm"}catch{}return"npm"}},vze=null;async function q9(n){return vze||(vze=await xze.create(n)),vze}async function yLt(){let n=await q9();J.output(""),J.output(X.cyan("Checking for updates..."));let t=await n.checkForUpdates(!0);return t.error?J.output(X.red(`Failed to check for updates: ${t.error}`)):t.updateAvailable?n.displayUpdateNotification(t):(J.output(""),J.output(X.green(`You are on the latest version (${t.currentVersion})`)),J.output("")),t}function ean(n){switch(n){case"major":return X.red("\u25CF");case"minor":return X.yellow("\u25CF");case"patch":return X.green("\u25CF");case"prerelease":return X.magenta("\u25CF");default:return X.cyan("\u25CF")}}async function tan(n){let t=await q9(n),i=t.getVersionInfo(),o=i.packageName,l=i.currentVersion;J.debug("Update check: querying npm registry",{packageName:o,currentVersion:l});try{let p=await t.checkForUpdates();if(J.debug("Update check: npm registry response",{updateAvailable:p.updateAvailable,latestVersion:p.latestVersion,updateType:p.updateType,error:p.error}),p.error){let h=`npm i -g ${o}`;return{type:"error",message:X.red("\u2717")+X.dim(" Update check failed. Manual upgrade: ")+X.cyan(h),currentVersion:l,packageName:o,manualCommand:h}}if(p.updateAvailable&&p.latestVersion){let h=ean(p.updateType),I=`npm i -g ${o}@${p.latestVersion}`;return{type:"available",message:h+X.dim(" Update available: ")+X.dim(l)+X.dim(" \u2192 ")+X.bold(p.latestVersion)+X.dim(` (${I})`),currentVersion:l,latestVersion:p.latestVersion,packageName:o,manualCommand:I}}return{type:"up-to-date",message:"",currentVersion:l,packageName:o}}catch{let h=`npm i -g ${o}`;return{type:"error",message:X.red("\u2717")+X.dim(" Update check failed. Manual upgrade: ")+X.cyan(h),currentVersion:l,packageName:o,manualCommand:h}}}async function bLt(n){J.debug("Update check: starting discrete update status check");let t=await tan(n);return J.debug("Update check: completed",{type:t.type,currentVersion:t.currentVersion,latestVersion:t.latestVersion,packageName:t.packageName}),t.type==="available"?(J.debug(`Update check: new version available (${t.latestVersion})`),console.log(t.message)):t.type==="error"?(J.debug("Update check: error occurred, showing manual upgrade command"),console.log(t.message)):t.type==="up-to-date"&&J.debug("Update check: already on latest version, no notification shown"),t}za();function ran(n){let t={check:!1,history:!1,force:!1,install:!1,version:!1,help:!1};for(let i=0;i<n.length;i++){let o=n[i].toLowerCase();switch(o){case"check":case"-c":case"--check":t.check=!0;break;case"history":case"-h":case"--history":t.history=!0;break;case"--force":case"-f":t.force=!0;break;case"install":case"-i":case"--install":t.install=!0;break;case"--npm":t.manager="npm";break;case"--yarn":t.manager="yarn";break;case"--pnpm":t.manager="pnpm";break;case"version":case"-v":case"--version":t.version=!0;break;case"help":case"--help":t.help=!0;break;default:o==="now"&&(t.install=!0);break}}return!t.history&&!t.install&&!t.version&&!t.help&&(t.check=!0),t}function nan(){let n=["",X.bold.cyan("Update Command"),X.dim("\u2500".repeat(40)),"",X.white("Check for and install updates to Compass CLI."),"",X.bold("Usage:"),` ${X.cyan("/update")} Check for updates`,` ${X.cyan("/update check")} Check for updates (same as above)`,` ${X.cyan("/update install")} Install available update`,` ${X.cyan("/update now")} Install update immediately`,` ${X.cyan("/update history")} Show update history`,` ${X.cyan("/update version")} Show version information`,"",X.bold("Options:"),` ${X.yellow("--force, -f")} Force check (ignore interval)`,` ${X.yellow("--npm")} Use npm for installation`,` ${X.yellow("--yarn")} Use yarn for installation`,` ${X.yellow("--pnpm")} Use pnpm for installation`,"",X.bold("Examples:"),` ${X.gray("/update")} # Check if update is available`,` ${X.gray("/update install --yarn")} # Install with yarn`,` ${X.gray("/update -f")} # Force update check`,""];J.output(n.join(`
|
|
1893
1893
|
`))}async function ian(){let t=(await q9()).getVersionInfo();J.output(""),J.output(X.bold.cyan("Compass CLI Version Information")),J.output(X.dim("\u2500".repeat(40))),J.output(""),J.output(` ${X.gray("Package:")} ${t.packageName}`),J.output(` ${X.gray("Current version:")} ${X.green(t.currentVersion)}`),t.lastCheck?(J.output(""),J.output(X.bold(" Last Update Check:")),J.output(` ${X.gray("Checked:")} ${new Date(t.lastCheck.checkedAt).toLocaleString()}`),t.updateAvailable&&t.latestVersion?(J.output(` ${X.gray("Status:")} ${X.yellow("Update available")}`),J.output(` ${X.gray("Latest:")} ${X.yellow(t.latestVersion)}`)):J.output(` ${X.gray("Status:")} ${X.green("Up to date")}`)):(J.output(""),J.output(X.gray(" No update check performed yet.")),J.output(X.gray(" Run /update to check for updates."))),J.output("")}async function san(){let t=(await q9()).getUpdateHistory();if(J.output(""),J.output(X.bold.cyan("Update History")),J.output(X.dim("\u2500".repeat(40))),t.length===0){J.output(""),J.output(X.gray(" No update history recorded.")),J.output("");return}J.output("");let i=t.slice().reverse();for(let o of i){let l=o.success?X.green("\u2713"):X.red("\u2717"),p=o.success?X.green:X.red;J.output(` ${l} ${X.gray(new Date(o.updatedAt).toLocaleDateString())}`),J.output(` ${X.gray("From:")} ${o.fromVersion} ${X.gray("\u2192")} ${p(o.toVersion)}`),J.output(` ${X.gray("Method:")} ${o.method}`),o.error&&J.output(` ${X.red("Error:")} ${o.error}`),J.output("")}}async function aan(n){let t=await q9(),i=n||await t.detectPackageManager();J.output(""),J.output(X.cyan(`Using ${i} to install update...`)),await t.performUpdate(i)||J.output(X.yellow("Tip: You can try a different package manager with --npm, --yarn, or --pnpm"))}var q2e=async n=>{let t=ran(n);try{if(t.help){nan();return}if(t.version){await ian();return}if(t.history){await san();return}if(t.install){await aan(t.manager);return}if(t.check){if(t.force){let i=await q9();J.output(""),J.output(X.cyan("Force checking for updates..."));let o=await i.checkForUpdates(!0);o.error?J.output(X.red(`Failed to check for updates: ${o.error}`)):o.updateAvailable?i.displayUpdateNotification(o):(J.output(""),J.output(X.green(`You are on the latest version (${o.currentVersion})`)),J.output(""))}else await yLt();return}}catch(i){let o=i instanceof Error?i.message:"Update command failed";J.error("Update command failed",i),J.output(X.red(`Error: ${o}`))}};var Aze={name:"update",aliases:["upgrade","up"],description:"Check for and install updates",usage:"/update [check|install|history|version] [--force] [--npm|--yarn|--pnpm]",examples:["/update","/update check","/update install","/update install --yarn","/update history","/update version"],handler:q2e};sp();var KZ=Sa(N5(),1);hI();Hw();Ah();za();import $2e from"path";import oan from"readline";var can={debug:X.gray,info:X.blue,warn:X.yellow,error:X.red},vLt={session_start:"\u25B6",session_end:"\u25A0",bash_executed:"$",file_read:"\u{1F4D6}",file_write:"\u{1F4DD}",file_delete:"\u{1F5D1}",file_rename:"\u{1F4CB}",tool_executed:"\u{1F527}",tool_registered:"\u2795",tool_failed:"\u274C",config_changed:"\u2699",provider_changed:"\u{1F504}",model_changed:"\u{1F916}",mcp_connected:"\u{1F50C}",mcp_disconnected:"\u{1F50C}",mcp_error:"\u26A0",workflow_started:"\u25B6",workflow_completed:"\u2713",workflow_failed:"\u2717",step_started:"\u2192",step_completed:"\u2713",step_failed:"\u2717",approval_requested:"\u2753",approval_granted:"\u2713",approval_denied:"\u2717",approval_timeout:"\u23F0",context_loaded:"\u{1F4E5}",context_saved:"\u{1F4E4}",context_compacted:"\u{1F5DC}",rate_limited:"\u{1F6AB}",retry_attempted:"\u{1F504}",api_error:"\u26A0",cache_hit:"\u{1F4BE}",cache_miss:"\u{1F4A8}",index_started:"\u{1F4C7}",index_completed:"\u{1F4C7}",complexity_analyzed:"\u{1F9E0}",git_operation:"\u{1F33F}",clarification_requested:"\u2753",clarification_completed:"\u{1F4AC}",plan_generated:"\u{1F4CB}",error:"\u274C"};function xie(n,t=!1){let i=can[n.level]||X.white,o=vLt[n.event]||"\u2022",l=new Date(n.ts).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit"}),p=`${X.gray(l)} ${i(o)} ${X.bold(i(n.event))} ${X.gray(`[${n.component}]`)}`;if(t&&n.data){let h=JSON.stringify(n.data,null,2).split(`
|