@kiroku-solutions/kiroku-ai 0.2.3 → 0.2.4
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/bin/kiroku-ai.mjs +21 -1
- package/package.json +1 -1
package/bin/kiroku-ai.mjs
CHANGED
|
@@ -213,7 +213,27 @@ async function main(argv) {
|
|
|
213
213
|
|
|
214
214
|
const runtimeDir = join(CACHE_ROOT, REF.replace(/[^a-zA-Z0-9._-]/g, '_'));
|
|
215
215
|
const cachedCli = join(runtimeDir, 'src', 'cli.mjs');
|
|
216
|
-
|
|
216
|
+
let cacheValid = existsSync(cachedCli) && existsSync(join(runtimeDir, 'node_modules')) && !REFRESH;
|
|
217
|
+
|
|
218
|
+
if (cacheValid) {
|
|
219
|
+
try {
|
|
220
|
+
const meta = JSON.parse(await readFile(join(runtimeDir, '.kiroku-meta.json'), 'utf8'));
|
|
221
|
+
const token = await resolveToken();
|
|
222
|
+
if (token && meta.sha) {
|
|
223
|
+
const url = `${API}/repos/${ORG}/${REPO}/commits/${encodeURIComponent(REF)}`;
|
|
224
|
+
const res = await fetch(url, { headers: ghHeaders(token, 'application/vnd.github+json') });
|
|
225
|
+
if (res.ok) {
|
|
226
|
+
const data = await res.json();
|
|
227
|
+
if (data.sha && data.sha !== meta.sha) {
|
|
228
|
+
cacheValid = false;
|
|
229
|
+
process.stdout.write(`New CLI version detected (sha: ${data.sha.slice(0, 7)}). Refreshing...\n`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
} catch {
|
|
234
|
+
// Ignore errors (offline, missing meta, etc) - keep cacheValid as true
|
|
235
|
+
}
|
|
236
|
+
}
|
|
217
237
|
|
|
218
238
|
if (!cacheValid) {
|
|
219
239
|
const token = await ensureToken();
|