@iloom/cli 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5F6IWWRS.js → chunk-EWJFUFPT.js} +2 -2
- package/dist/chunk-EWJFUFPT.js.map +1 -0
- package/dist/{chunk-B2UO6EYE.js → chunk-NGJZ4TOU.js} +21 -3
- package/dist/{chunk-B2UO6EYE.js.map → chunk-NGJZ4TOU.js.map} +1 -1
- package/dist/cli.js +5 -4
- package/dist/cli.js.map +1 -1
- package/dist/{installation-detector-VXZOCL6P.js → installation-detector-MMFWLJYN.js} +2 -2
- package/dist/{update-5NOHT4SG.js → update-HJKDYA3F.js} +3 -3
- package/dist/{update-notifier-ARA5SPUW.js → update-notifier-LBAUOOLM.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-5F6IWWRS.js.map +0 -1
- /package/dist/{installation-detector-VXZOCL6P.js.map → installation-detector-MMFWLJYN.js.map} +0 -0
- /package/dist/{update-5NOHT4SG.js.map → update-HJKDYA3F.js.map} +0 -0
- /package/dist/{update-notifier-ARA5SPUW.js.map → update-notifier-LBAUOOLM.js.map} +0 -0
|
@@ -10,7 +10,7 @@ function detectInstallationMethod(scriptPath) {
|
|
|
10
10
|
logger.debug(`[installation-detector] Detecting installation method for: ${scriptPath}`);
|
|
11
11
|
if (process.env.OVERRIDE_INSTALLATION_METHOD) {
|
|
12
12
|
const overrideMethod = process.env.OVERRIDE_INSTALLATION_METHOD;
|
|
13
|
-
logger.
|
|
13
|
+
logger.debug(`[installation-detector] Override detected, returning: ${overrideMethod}`);
|
|
14
14
|
return overrideMethod;
|
|
15
15
|
}
|
|
16
16
|
try {
|
|
@@ -72,4 +72,4 @@ export {
|
|
|
72
72
|
detectInstallationMethod,
|
|
73
73
|
shouldShowUpdateNotification
|
|
74
74
|
};
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
//# sourceMappingURL=chunk-EWJFUFPT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/installation-detector.ts"],"sourcesContent":["import { dirname, join } from 'path'\nimport { existsSync, lstatSync, realpathSync } from 'fs'\nimport { logger } from './logger.js'\n\nexport type InstallationMethod = 'global' | 'local' | 'linked' | 'unknown'\n\n/**\n * Detect how iloom-cli is installed\n * - global: npm install -g (in global node_modules)\n * - local: Running from source directory (has src/ sibling to dist/)\n * - linked: npm link (symlinked executable)\n * - unknown: Cannot determine\n */\nexport function detectInstallationMethod(scriptPath: string): InstallationMethod {\n logger.debug(`[installation-detector] Detecting installation method for: ${scriptPath}`)\n\n if (process.env.OVERRIDE_INSTALLATION_METHOD) {\n const overrideMethod = process.env.OVERRIDE_INSTALLATION_METHOD as InstallationMethod\n logger.debug(`[installation-detector] Override detected, returning: ${overrideMethod}`)\n return overrideMethod\n }\n\n try {\n // Check if the script is a symlink (npm link creates symlinks)\n try {\n const stats = lstatSync(scriptPath)\n if (stats.isSymbolicLink()) {\n logger.debug(`[installation-detector] Script is a symlink`)\n // Resolve symlink to check where it actually points\n const realPath = realpathSync(scriptPath)\n logger.debug(`[installation-detector] Symlink resolves to: ${realPath}`)\n // If the real path is in node_modules, it's a global install\n // Only return 'linked' if it points outside node_modules\n if (!realPath.includes('/node_modules/')) {\n logger.debug(`[installation-detector] Symlink points outside node_modules, classification: linked`)\n return 'linked'\n }\n logger.debug(`[installation-detector] Symlink points to node_modules, treating as potential global install`)\n // Otherwise, continue checking with the resolved path\n scriptPath = realPath\n }\n } catch {\n // If we can't stat it, continue to other checks\n logger.debug(`[installation-detector] Unable to stat script file, continuing to other checks`)\n }\n\n // Check if running from source directory\n // If the file is at dist/cli.js, check if src/ exists as a sibling\n if (scriptPath.includes('/dist/') || scriptPath.includes('\\\\dist\\\\')) {\n logger.debug(`[installation-detector] Script is in dist/ directory, checking for local development setup`)\n const distDir = dirname(scriptPath) // dist/\n const projectRoot = dirname(distDir) // project root\n const srcDir = join(projectRoot, 'src')\n const packageJsonPath = join(projectRoot, 'package.json')\n logger.debug(`[installation-detector] Looking for src/ at: ${srcDir}`)\n logger.debug(`[installation-detector] Looking for package.json at: ${packageJsonPath}`)\n\n // If src/ and package.json exist in parent, we're running from source\n if (existsSync(srcDir) && existsSync(packageJsonPath)) {\n logger.debug(`[installation-detector] Found src/ and package.json, classification: local`)\n return 'local'\n }\n }\n\n // Check if in global node_modules\n // Global installs are typically in:\n // - /usr/local/lib/node_modules/ (macOS/Linux)\n // - ~/.nvm/versions/node/*/lib/node_modules/ (NVM)\n // - C:\\Users\\*\\AppData\\Roaming\\npm\\node_modules\\ (Windows)\n // - /opt/homebrew/lib/node_modules (Homebrew on Apple Silicon)\n const globalPatterns = [\n '/lib/node_modules/',\n '/.nvm/versions/node/',\n '/AppData/Roaming/npm/node_modules/',\n '/.local/lib/node_modules/',\n ]\n\n const normalizedPath = scriptPath.replace(/\\\\/g, '/')\n logger.debug(`[installation-detector] Checking global patterns against: ${normalizedPath}`)\n for (const pattern of globalPatterns) {\n if (normalizedPath.includes(pattern)) {\n logger.debug(`[installation-detector] Matched global pattern '${pattern}', classification: global`)\n return 'global'\n }\n }\n\n logger.debug(`[installation-detector] No patterns matched, classification: unknown`)\n return 'unknown'\n } catch (error) {\n logger.debug(`[installation-detector] Error during detection: ${error}, classification: unknown`)\n return 'unknown'\n }\n}\n\n/**\n * Determine if update notifications should be shown\n * Returns true only for global installations\n */\nexport function shouldShowUpdateNotification(method: InstallationMethod): boolean {\n return method === 'global'\n}\n"],"mappings":";;;;;;AAAA,SAAS,SAAS,YAAY;AAC9B,SAAS,YAAY,WAAW,oBAAoB;AAY7C,SAAS,yBAAyB,YAAwC;AAC/E,SAAO,MAAM,8DAA8D,UAAU,EAAE;AAEvF,MAAI,QAAQ,IAAI,8BAA8B;AAC5C,UAAM,iBAAiB,QAAQ,IAAI;AACnC,WAAO,MAAM,yDAAyD,cAAc,EAAE;AACtF,WAAO;AAAA,EACT;AAEA,MAAI;AAEF,QAAI;A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ChF,SAAO,WAAW;AACpB;","names":[]}
|
|
@@ -173,7 +173,7 @@ var UpdateNotifier = class {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
async function checkAndNotifyUpdate(currentVersion, packageName, installMethod) {
|
|
176
|
+
async function checkAndNotifyUpdate(currentVersion, packageName, installMethod, options) {
|
|
177
177
|
logger.debug(`checkAndNotifyUpdate: Called with version=${currentVersion}, package=${packageName}, installMethod=${installMethod}`);
|
|
178
178
|
try {
|
|
179
179
|
if (installMethod !== "global") {
|
|
@@ -182,11 +182,29 @@ async function checkAndNotifyUpdate(currentVersion, packageName, installMethod)
|
|
|
182
182
|
}
|
|
183
183
|
logger.debug("checkAndNotifyUpdate: Creating UpdateNotifier instance");
|
|
184
184
|
const notifier = new UpdateNotifier(currentVersion, packageName);
|
|
185
|
+
const fakeUpdateEnv = process.env.ILOOM_FAKE_UPDATE_AVAILABLE;
|
|
186
|
+
if (fakeUpdateEnv === "1" || fakeUpdateEnv === "true") {
|
|
187
|
+
logger.debug("checkAndNotifyUpdate: ILOOM_FAKE_UPDATE_AVAILABLE is set, using fake update result");
|
|
188
|
+
const fakeResult = {
|
|
189
|
+
currentVersion,
|
|
190
|
+
latestVersion: "99.99.99",
|
|
191
|
+
updateAvailable: true
|
|
192
|
+
};
|
|
193
|
+
if (!(options == null ? void 0 : options.suppressOutput)) {
|
|
194
|
+
logger.debug("checkAndNotifyUpdate: Displaying fake update notification");
|
|
195
|
+
notifier.displayUpdateNotification(fakeResult);
|
|
196
|
+
} else {
|
|
197
|
+
logger.debug("checkAndNotifyUpdate: Suppressing fake update notification (suppressOutput=true)");
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
185
201
|
logger.debug("checkAndNotifyUpdate: Calling checkForUpdates()");
|
|
186
202
|
const result = await notifier.checkForUpdates();
|
|
187
|
-
if (result !== null) {
|
|
203
|
+
if (result !== null && !(options == null ? void 0 : options.suppressOutput)) {
|
|
188
204
|
logger.debug(`checkAndNotifyUpdate: Got result, calling displayUpdateNotification`);
|
|
189
205
|
notifier.displayUpdateNotification(result);
|
|
206
|
+
} else if (result !== null && (options == null ? void 0 : options.suppressOutput)) {
|
|
207
|
+
logger.debug("checkAndNotifyUpdate: Suppressing update notification (suppressOutput=true)");
|
|
190
208
|
} else {
|
|
191
209
|
logger.debug("checkAndNotifyUpdate: Result was null, not displaying notification");
|
|
192
210
|
}
|
|
@@ -200,4 +218,4 @@ export {
|
|
|
200
218
|
UpdateNotifier,
|
|
201
219
|
checkAndNotifyUpdate
|
|
202
220
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
221
|
+
//# sourceMappingURL=chunk-NGJZ4TOU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/update-notifier.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport fs from 'fs-extra'\nimport { execa } from 'execa'\nimport chalk from 'chalk'\nimport { logger } from './logger.js'\n\nexport interface UpdateCheckCache {\n lastCheck: number // timestamp\n latestVersion: string\n}\n\nexport interface UpdateCheckResult {\n currentVersion: string\n latestVersion: string\n updateAvailable: boolean\n}\n\nexport class UpdateNotifier {\n private cacheFilePath: string\n private currentVersion: string\n private packageName: string\n\n constructor(currentVersion: string, packageName: string) {\n this.currentVersion = currentVersion\n this.packageName = packageName\n // Cross-platform cache directory\n const configDir = path.join(os.homedir(), '.config', 'iloom-ai')\n this.cacheFilePath = path.join(configDir, 'update-check.json')\n logger.debug(`UpdateNotifier initialized: version=${currentVersion}, package=${packageName}, cachePath=${this.cacheFilePath}`)\n }\n\n /**\n * Check for updates, respecting 24hr cache\n * Returns UpdateCheckResult or null if check failed/not needed\n */\n async checkForUpdates(): Promise<UpdateCheckResult | null> {\n logger.debug('checkForUpdates: Starting update check')\n try {\n // Check cache first\n logger.debug('checkForUpdates: Checking cache')\n const cached = await this.getCachedCheck()\n if (cached !== null) {\n logger.debug(`checkForUpdates: Using cached result - latest=${cached.latestVersion}, lastCheck=${new Date(cached.lastCheck).toISOString()}`)\n const updateAvailable = this.isNewerVersion(this.currentVersion, cached.latestVersion)\n logger.debug(`checkForUpdates: Update available from cache: ${updateAvailable}`)\n return {\n currentVersion: this.currentVersion,\n latestVersion: cached.latestVersion,\n updateAvailable,\n }\n }\n\n logger.debug('checkForUpdates: No valid cache, querying npm registry')\n // Query npm registry\n const latestVersion = await this.fetchLatestVersion()\n if (latestVersion === null) {\n logger.debug('checkForUpdates: Failed to fetch latest version from npm')\n return null\n }\n\n logger.debug(`checkForUpdates: Fetched latest version: ${latestVersion}`)\n\n // Save to cache\n logger.debug('checkForUpdates: Saving to cache')\n await this.saveCacheFile(latestVersion)\n\n const updateAvailable = this.isNewerVersion(this.currentVersion, latestVersion)\n logger.debug(`checkForUpdates: Update available: ${updateAvailable} (current=${this.currentVersion}, latest=${latestVersion})`)\n\n return {\n currentVersion: this.currentVersion,\n latestVersion,\n updateAvailable,\n }\n } catch (error) {\n // Handle all errors gracefully - update check should never break user experience\n logger.debug(`checkForUpdates: Error during update check: ${error}`)\n return null\n }\n }\n\n /**\n * Read cache file, return null if stale or missing\n */\n private async getCachedCheck(): Promise<UpdateCheckCache | null> {\n logger.debug(`getCachedCheck: Checking cache file at ${this.cacheFilePath}`)\n try {\n if (!fs.existsSync(this.cacheFilePath)) {\n logger.debug('getCachedCheck: Cache file does not exist')\n return null\n }\n\n logger.debug('getCachedCheck: Cache file exists, reading contents')\n const content = await fs.readFile(this.cacheFilePath, 'utf8')\n logger.debug(`getCachedCheck: Cache file content: ${content}`)\n const cache = JSON.parse(content) as UpdateCheckCache\n\n // Check if cache is still fresh (< configurable hours)\n const cacheTimeoutMins = parseInt(process.env.ILOOM_UPDATE_CACHE_TIMEOUT_MINS ?? '60', 10) // Default 1 hour\n const cacheTimeoutMs = cacheTimeoutMins * 60 * 1000\n logger.debug(`getCachedCheck: Using cache timeout of ${cacheTimeoutMins} minutes`)\n const now = Date.now()\n const age = now - cache.lastCheck\n const ageHours = age / (60 * 60 * 1000)\n logger.debug(`getCachedCheck: Cache age: ${ageHours.toFixed(2)} hours (threshold: ${cacheTimeoutMins / 60} hours)`)\n\n if (now - cache.lastCheck < cacheTimeoutMs) {\n logger.debug('getCachedCheck: Cache is fresh, returning cached data')\n return cache\n }\n\n logger.debug('getCachedCheck: Cache is stale, will query npm registry')\n return null\n } catch (error) {\n // If cache is corrupted or unreadable, treat as missing\n logger.debug(`getCachedCheck: Error reading cache: ${error}`)\n return null\n }\n }\n\n /**\n * Save successful check to cache\n */\n private async saveCacheFile(latestVersion: string): Promise<void> {\n logger.debug(`saveCacheFile: Attempting to save cache for version ${latestVersion}`)\n try {\n // Ensure cache directory exists\n const configDir = path.dirname(this.cacheFilePath)\n logger.debug(`saveCacheFile: Ensuring cache directory exists: ${configDir}`)\n await fs.ensureDir(configDir)\n\n // Write cache file\n const cache: UpdateCheckCache = {\n lastCheck: Date.now(),\n latestVersion,\n }\n const cacheJson = JSON.stringify(cache, null, 2)\n logger.debug(`saveCacheFile: Writing cache file: ${cacheJson}`)\n await fs.writeFile(this.cacheFilePath, cacheJson, 'utf8')\n logger.debug(`saveCacheFile: Cache file saved successfully to ${this.cacheFilePath}`)\n } catch (error) {\n // Log debug message but don't throw - cache write failure shouldn't break anything\n logger.debug(`saveCacheFile: Failed to save update check cache to ${this.cacheFilePath}: ${error}`)\n }\n }\n\n /**\n * Display update notification to user\n */\n displayUpdateNotification(result: UpdateCheckResult): void {\n logger.debug(`displayUpdateNotification: updateAvailable=${result.updateAvailable}, current=${result.currentVersion}, latest=${result.latestVersion}`)\n if (result.updateAvailable) {\n logger.debug('displayUpdateNotification: Displaying update notification to user')\n // Simple, clear update notification\n /* eslint-disable no-console */\n console.log('')\n console.log(' ' + chalk.bold(`Update available: ${result.currentVersion} → ${result.latestVersion}`))\n console.log(' ' + chalk.bold('Run: il update'))\n console.log('')\n /* eslint-enable no-console */\n } else {\n logger.debug('displayUpdateNotification: No update available, skipping notification')\n }\n }\n\n /**\n * Query npm registry for latest version\n */\n private async fetchLatestVersion(): Promise<string | null> {\n logger.debug(`fetchLatestVersion: Querying npm for package ${this.packageName}`)\n try {\n const { stdout } = await execa('npm', ['view', this.packageName, 'version'], {\n timeout: 5000,\n })\n const version = stdout.trim()\n logger.debug(`fetchLatestVersion: npm returned version: ${version}`)\n return version\n } catch (error) {\n // Network errors, timeouts, npm not available, or package not found\n logger.debug(`fetchLatestVersion: Failed to query npm: ${error}`)\n return null\n }\n }\n\n /**\n * Compare semver versions\n * Returns true if latest > current\n */\n private isNewerVersion(current: string, latest: string): boolean {\n logger.debug(`isNewerVersion: Comparing versions - current=${current}, latest=${latest}`)\n // Simple version comparison: split by dots and compare numerically\n try {\n const currentParts = current.split('.').map(p => parseInt(p, 10))\n const latestParts = latest.split('.').map(p => parseInt(p, 10))\n logger.debug(`isNewerVersion: Parsed parts - current=[${currentParts.join(', ')}], latest=[${latestParts.join(', ')}]`)\n\n for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {\n const curr = currentParts[i] ?? 0\n const next = latestParts[i] ?? 0\n\n logger.debug(`isNewerVersion: Comparing part ${i}: current=${curr}, latest=${next}`)\n\n if (next > curr) {\n logger.debug(`isNewerVersion: Latest is newer (${next} > ${curr})`)\n return true\n }\n if (next < curr) {\n logger.debug(`isNewerVersion: Current is newer (${curr} > ${next})`)\n return false\n }\n }\n\n logger.debug('isNewerVersion: Versions are equal')\n return false\n } catch (error) {\n // If parsing fails, assume no update\n logger.debug(`isNewerVersion: Error comparing versions: ${error}`)\n return false\n }\n }\n}\n\n/**\n * Main entry point for update check\n * Call from CLI postAction hook\n */\nexport async function checkAndNotifyUpdate(\n currentVersion: string,\n packageName: string,\n installMethod: string\n): Promise<void> {\n logger.debug(`checkAndNotifyUpdate: Called with version=${currentVersion}, package=${packageName}, installMethod=${installMethod}`)\n try {\n // Only check for global installations\n if (installMethod !== 'global') {\n logger.debug(`checkAndNotifyUpdate: Skipping update check - not a global installation (method=${installMethod})`)\n return\n }\n\n logger.debug('checkAndNotifyUpdate: Creating UpdateNotifier instance')\n const notifier = new UpdateNotifier(currentVersion, packageName)\n\n logger.debug('checkAndNotifyUpdate: Calling checkForUpdates()')\n const result = await notifier.checkForUpdates()\n\n if (result !== null) {\n logger.debug(`checkAndNotifyUpdate: Got result, calling displayUpdateNotification`)\n notifier.displayUpdateNotification(result)\n } else {\n logger.debug('checkAndNotifyUpdate: Result was null, not displaying notification')\n }\n\n logger.debug('checkAndNotifyUpdate: Completed')\n } catch (error) {\n // All errors handled internally - this should never throw\n logger.debug(`checkAndNotifyUpdate: Unexpected error: ${error}`)\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,aAAa;AACtB,OAAO,WAAW;AAcX,IAAM,iBAAN,MAAqB;AAAA,EAK1B,YAAY,gBAAwB,aAAqB;AACvD,SAAK,iBAAiB;AACtB,SAAK,cAAc;AAEnB,UAAM,YAAY,KAAK,KAAK,GAAG,QAAQ,GAAG,WAAW,UAAU;AAC/D,SAAK,gBAAgB,KAAK,KAAK,WAAW,mBAAmB;AAC7D,WAAO,MAAM,uCAAuC,cAAc,aAAa,WAAW,eAAe,KAAK,aAAa,EAAE;AAAA,EAC/H;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,kBAAqD;AACzD,WAAO,MAAM,wCAAwC;AACrD,QAAI;AAEF,aAAO,MAAM,iCAAiC;AAC9C,YAAM,SAAS,MAAM,KAAK,eAAe;AACzC,UAAI,WAAW,MAAM;AACnB,eAAO,MAAM,iDAAiD,OAAO,aAAa,eAAe,IAAI,KAAK,OAAO,SAAS,EAAE,YAAY,CAAC,EAAE;AAC3I,cAAMA,mBAAkB,KAAK,eAAe,KAAK,gBAAgB,OAAO,aAAa;AACrF,eAAO,MAAM,iDAAiDA,gBAAe,EAAE;AAC/E,eAAO;AAAA,UACL,gBAAgB,KAAK;AAAA,UACrB,eAAe,OAAO;AA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C;AACjD,aAAO;AAAA,IACT,SAAS,OAAO;AAEd,aAAO,MAAM,6CAA6C,KAAK,EAAE;AACjE,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAMA,eAAsB,qBACpB,gBACA,aACA,eACe;AACf,SAAO,MAAM,6CAA6C,cAAc,aAAa,WAAW,mBAAmB,aAAa,EAAE;AAClI,MAAI;AAEF,QAAI,kBAAkB,UAAU;AAC9B,aAAO,MAAM,mFAAmF,aAAa,GAAG;AAChH;AAAA,IACF;AAEA,WAAO,MAAM,wDAAwD;AACrE,UAAM,WAAW,IAAI,eAAe,gBAAgB,WAAW;AAE/D,WAAO,MAAM,iDAAiD;AAC9D,UAAM,SAAS,MAAM,SAAS,gBAAgB;AAE9C,QAAI,WAAW,MAAM;AACnB,aAAO,MAAM,qEAAqE;AAClF,eAAS,0BAA0B,MAAM;AAAA,IAC3C,OAAO;AACL,aAAO,MAAM,oEAAoE;AAAA,IACnF;AAEA,WAAO,MAAM,iCAAiC;AAAA,EAChD,SAAS,OAAO;AAEd,WAAO,MAAM,2CAA2C,KAAK,EAAE;AAAA,EACjE;AACF;","names":["updateAvailable"]}
|
|
1
|
+
{"version":3,"sources":["../src/utils/update-notifier.ts"],"sourcesContent":["import os from 'os'\nimport path from 'path'\nimport fs from 'fs-extra'\nimport { execa } from 'execa'\nimport chalk from 'chalk'\nimport { logger } from './logger.js'\n\nexport interface UpdateCheckCache {\n lastCheck: number // timestamp\n latestVersion: string\n}\n\nexport interface UpdateCheckResult {\n currentVersion: string\n latestVersion: string\n updateAvailable: boolean\n}\n\nexport class UpdateNotifier {\n private cacheFilePath: string\n private currentVersion: string\n private packageName: string\n\n constructor(currentVersion: string, packageName: string) {\n this.currentVersion = currentVersion\n this.packageName = packageName\n // Cross-platform cache directory\n const configDir = path.join(os.homedir(), '.config', 'iloom-ai')\n this.cacheFilePath = path.join(configDir, 'update-check.json')\n logger.debug(`UpdateNotifier initialized: version=${currentVersion}, package=${packageName}, cachePath=${this.cacheFilePath}`)\n }\n\n /**\n * Check for updates, respecting 24hr cache\n * Returns UpdateCheckResult or null if check failed/not needed\n */\n async checkForUpdates(): Promise<UpdateCheckResult | null> {\n logger.debug('checkForUpdates: Starting update check')\n try {\n // Check cache first\n logger.debug('checkForUpdates: Checking cache')\n const cached = await this.getCachedCheck()\n if (cached !== null) {\n logger.debug(`checkForUpdates: Using cached result - latest=${cached.latestVersion}, lastCheck=${new Date(cached.lastCheck).toISOString()}`)\n const updateAvailable = this.isNewerVersion(this.currentVersion, cached.latestVersion)\n logger.debug(`checkForUpdates: Update available from cache: ${updateAvailable}`)\n return {\n currentVersion: this.currentVersion,\n latestVersion: cached.latestVersion,\n updateAvailable,\n }\n }\n\n logger.debug('checkForUpdates: No valid cache, querying npm registry')\n // Query npm registry\n const latestVersion = await this.fetchLatestVersion()\n if (latestVersion === null) {\n logger.debug('checkForUpdates: Failed to fetch latest version from npm')\n return null\n }\n\n logger.debug(`checkForUpdates: Fetched latest version: ${latestVersion}`)\n\n // Save to cache\n logger.debug('checkForUpdates: Saving to cache')\n await this.saveCacheFile(latestVersion)\n\n const updateAvailable = this.isNewerVersion(this.currentVersion, latestVersion)\n logger.debug(`checkForUpdates: Update available: ${updateAvailable} (current=${this.currentVersion}, latest=${latestVersion})`)\n\n return {\n currentVersion: this.currentVersion,\n latestVersion,\n updateAvailable,\n }\n } catch (error) {\n // Handle all errors gracefully - update check should never break user experience\n logger.debug(`checkForUpdates: Error during update check: ${error}`)\n return null\n }\n }\n\n /**\n * Read cache file, return null if stale or missing\n */\n private async getCachedCheck(): Promise<UpdateCheckCache | null> {\n logger.debug(`getCachedCheck: Checking cache file at ${this.cacheFilePath}`)\n try {\n if (!fs.existsSync(this.cacheFilePath)) {\n logger.debug('getCachedCheck: Cache file does not exist')\n return null\n }\n\n logger.debug('getCachedCheck: Cache file exists, reading contents')\n const content = await fs.readFile(this.cacheFilePath, 'utf8')\n logger.debug(`getCachedCheck: Cache file content: ${content}`)\n const cache = JSON.parse(content) as UpdateCheckCache\n\n // Check if cache is still fresh (< configurable hours)\n const cacheTimeoutMins = parseInt(process.env.ILOOM_UPDATE_CACHE_TIMEOUT_MINS ?? '60', 10) // Default 1 hour\n const cacheTimeoutMs = cacheTimeoutMins * 60 * 1000\n logger.debug(`getCachedCheck: Using cache timeout of ${cacheTimeoutMins} minutes`)\n const now = Date.now()\n const age = now - cache.lastCheck\n const ageHours = age / (60 * 60 * 1000)\n logger.debug(`getCachedCheck: Cache age: ${ageHours.toFixed(2)} hours (threshold: ${cacheTimeoutMins / 60} hours)`)\n\n if (now - cache.lastCheck < cacheTimeoutMs) {\n logger.debug('getCachedCheck: Cache is fresh, returning cached data')\n return cache\n }\n\n logger.debug('getCachedCheck: Cache is stale, will query npm registry')\n return null\n } catch (error) {\n // If cache is corrupted or unreadable, treat as missing\n logger.debug(`getCachedCheck: Error reading cache: ${error}`)\n return null\n }\n }\n\n /**\n * Save successful check to cache\n */\n private async saveCacheFile(latestVersion: string): Promise<void> {\n logger.debug(`saveCacheFile: Attempting to save cache for version ${latestVersion}`)\n try {\n // Ensure cache directory exists\n const configDir = path.dirname(this.cacheFilePath)\n logger.debug(`saveCacheFile: Ensuring cache directory exists: ${configDir}`)\n await fs.ensureDir(configDir)\n\n // Write cache file\n const cache: UpdateCheckCache = {\n lastCheck: Date.now(),\n latestVersion,\n }\n const cacheJson = JSON.stringify(cache, null, 2)\n logger.debug(`saveCacheFile: Writing cache file: ${cacheJson}`)\n await fs.writeFile(this.cacheFilePath, cacheJson, 'utf8')\n logger.debug(`saveCacheFile: Cache file saved successfully to ${this.cacheFilePath}`)\n } catch (error) {\n // Log debug message but don't throw - cache write failure shouldn't break anything\n logger.debug(`saveCacheFile: Failed to save update check cache to ${this.cacheFilePath}: ${error}`)\n }\n }\n\n /**\n * Display update notification to user\n */\n displayUpdateNotification(result: UpdateCheckResult): void {\n logger.debug(`displayUpdateNotification: updateAvailable=${result.updateAvailable}, current=${result.currentVersion}, latest=${result.latestVersion}`)\n if (result.updateAvailable) {\n logger.debug('displayUpdateNotification: Displaying update notification to user')\n // Simple, clear update notification\n /* eslint-disable no-console */\n console.log('')\n console.log(' ' + chalk.bold(`Update available: ${result.currentVersion} → ${result.latestVersion}`))\n console.log(' ' + chalk.bold('Run: il update'))\n console.log('')\n /* eslint-enable no-console */\n } else {\n logger.debug('displayUpdateNotification: No update available, skipping notification')\n }\n }\n\n /**\n * Query npm registry for latest version\n */\n private async fetchLatestVersion(): Promise<string | null> {\n logger.debug(`fetchLatestVersion: Querying npm for package ${this.packageName}`)\n try {\n const { stdout } = await execa('npm', ['view', this.packageName, 'version'], {\n timeout: 5000,\n })\n const version = stdout.trim()\n logger.debug(`fetchLatestVersion: npm returned version: ${version}`)\n return version\n } catch (error) {\n // Network errors, timeouts, npm not available, or package not found\n logger.debug(`fetchLatestVersion: Failed to query npm: ${error}`)\n return null\n }\n }\n\n /**\n * Compare semver versions\n * Returns true if latest > current\n */\n private isNewerVersion(current: string, latest: string): boolean {\n logger.debug(`isNewerVersion: Comparing versions - current=${current}, latest=${latest}`)\n // Simple version comparison: split by dots and compare numerically\n try {\n const currentParts = current.split('.').map(p => parseInt(p, 10))\n const latestParts = latest.split('.').map(p => parseInt(p, 10))\n logger.debug(`isNewerVersion: Parsed parts - current=[${currentParts.join(', ')}], latest=[${latestParts.join(', ')}]`)\n\n for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {\n const curr = currentParts[i] ?? 0\n const next = latestParts[i] ?? 0\n\n logger.debug(`isNewerVersion: Comparing part ${i}: current=${curr}, latest=${next}`)\n\n if (next > curr) {\n logger.debug(`isNewerVersion: Latest is newer (${next} > ${curr})`)\n return true\n }\n if (next < curr) {\n logger.debug(`isNewerVersion: Current is newer (${curr} > ${next})`)\n return false\n }\n }\n\n logger.debug('isNewerVersion: Versions are equal')\n return false\n } catch (error) {\n // If parsing fails, assume no update\n logger.debug(`isNewerVersion: Error comparing versions: ${error}`)\n return false\n }\n }\n}\n\n/**\n * Main entry point for update check\n * Call from CLI postAction hook\n */\nexport async function checkAndNotifyUpdate(\n currentVersion: string,\n packageName: string,\n installMethod: string,\n options?: { suppressOutput?: boolean }\n): Promise<void> {\n logger.debug(`checkAndNotifyUpdate: Called with version=${currentVersion}, package=${packageName}, installMethod=${installMethod}`)\n try {\n // Only check for global installations\n if (installMethod !== 'global') {\n logger.debug(`checkAndNotifyUpdate: Skipping update check - not a global installation (method=${installMethod})`)\n return\n }\n\n logger.debug('checkAndNotifyUpdate: Creating UpdateNotifier instance')\n const notifier = new UpdateNotifier(currentVersion, packageName)\n\n // Check for fake update flag (for testing purposes)\n const fakeUpdateEnv = process.env.ILOOM_FAKE_UPDATE_AVAILABLE\n if (fakeUpdateEnv === '1' || fakeUpdateEnv === 'true') {\n logger.debug('checkAndNotifyUpdate: ILOOM_FAKE_UPDATE_AVAILABLE is set, using fake update result')\n const fakeResult: UpdateCheckResult = {\n currentVersion,\n latestVersion: '99.99.99',\n updateAvailable: true,\n }\n if (!options?.suppressOutput) {\n logger.debug('checkAndNotifyUpdate: Displaying fake update notification')\n notifier.displayUpdateNotification(fakeResult)\n } else {\n logger.debug('checkAndNotifyUpdate: Suppressing fake update notification (suppressOutput=true)')\n }\n return\n }\n\n logger.debug('checkAndNotifyUpdate: Calling checkForUpdates()')\n const result = await notifier.checkForUpdates()\n\n if (result !== null && !options?.suppressOutput) {\n logger.debug(`checkAndNotifyUpdate: Got result, calling displayUpdateNotification`)\n notifier.displayUpdateNotification(result)\n } else if (result !== null && options?.suppressOutput) {\n logger.debug('checkAndNotifyUpdate: Suppressing update notification (suppressOutput=true)')\n } else {\n logger.debug('checkAndNotifyUpdate: Result was null, not displaying notification')\n }\n\n logger.debug('checkAndNotifyUpdate: Completed')\n } catch (error) {\n // All errors handled internally - this should never throw\n logger.debug(`checkAndNotifyUpdate: Unexpected error: ${error}`)\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,aAA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FAAoF;AACjG,YAAM,aAAgC;AAAA,QACpC;AAAA,QACA,eAAe;AAAA,QACf,iBAAiB;AAAA,MACnB;AACA,UAAI,EAAC,mCAAS,iBAAgB;AAC5B,eAAO,MAAM,2DAA2D;AACxE,iBAAS,0BAA0B,UAAU;AAAA,MAC/C,OAAO;AACL,eAAO,MAAM,kFAAkF;AAAA,MACjG;AACA;AAAA,IACF;AAEA,WAAO,MAAM,iDAAiD;AAC9D,UAAM,SAAS,MAAM,SAAS,gBAAgB;AAE9C,QAAI,WAAW,QAAQ,EAAC,mCAAS,iBAAgB;AAC/C,aAAO,MAAM,qEAAqE;AAClF,eAAS,0BAA0B,MAAM;AAAA,IAC3C,WAAW,WAAW,SAAQ,mCAAS,iBAAgB;AACrD,aAAO,MAAM,6EAA6E;AAAA,IAC5F,OAAO;AACL,aAAO,MAAM,oEAAoE;AAAA,IACnF;AAEA,WAAO,MAAM,iCAAiC;AAAA,EAChD,SAAS,OAAO;AAEd,WAAO,MAAM,2CAA2C,KAAK,EAAE;AAAA,EACjE;AACF;","names":["updateAvailable"]}
|
package/dist/cli.js
CHANGED
|
@@ -2240,10 +2240,11 @@ program.name("iloom").description(packageJson.description).version(packageJson.v
|
|
|
2240
2240
|
process.exit(0);
|
|
2241
2241
|
}
|
|
2242
2242
|
try {
|
|
2243
|
-
const { checkAndNotifyUpdate } = await import("./update-notifier-
|
|
2244
|
-
const { detectInstallationMethod } = await import("./installation-detector-
|
|
2243
|
+
const { checkAndNotifyUpdate } = await import("./update-notifier-LBAUOOLM.js");
|
|
2244
|
+
const { detectInstallationMethod } = await import("./installation-detector-MMFWLJYN.js");
|
|
2245
2245
|
const installMethod = detectInstallationMethod(__filename);
|
|
2246
|
-
|
|
2246
|
+
const jsonMode = actionCommand.opts().json === true;
|
|
2247
|
+
await checkAndNotifyUpdate(packageJson.version, packageJson.name, installMethod, { suppressOutput: jsonMode });
|
|
2247
2248
|
} catch {
|
|
2248
2249
|
}
|
|
2249
2250
|
try {
|
|
@@ -2971,7 +2972,7 @@ program.command("contribute").description("Set up local development environment
|
|
|
2971
2972
|
});
|
|
2972
2973
|
program.command("update").description("Update iloom-cli to the latest version").option("--dry-run", "Show what would be done without actually updating").action(async (options) => {
|
|
2973
2974
|
try {
|
|
2974
|
-
const { UpdateCommand } = await import("./update-
|
|
2975
|
+
const { UpdateCommand } = await import("./update-HJKDYA3F.js");
|
|
2975
2976
|
const command = new UpdateCommand();
|
|
2976
2977
|
await command.execute(options);
|
|
2977
2978
|
} catch (error) {
|