repowise 0.1.60 → 0.1.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/dist/bin/repowise.js +25 -13
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -494,17 +494,6 @@ async function handleCatchUp(offlineState, pollClient, repoIds, state, repoLocal
|
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
async function startListener(options) {
|
|
497
|
-
const origLog = console.log.bind(console);
|
|
498
|
-
const origError = console.error.bind(console);
|
|
499
|
-
const origWarn = console.warn.bind(console);
|
|
500
|
-
const ts = () => {
|
|
501
|
-
const d = /* @__PURE__ */ new Date();
|
|
502
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
503
|
-
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
504
|
-
};
|
|
505
|
-
console.log = (...args) => origLog(`[${ts()}]`, ...args);
|
|
506
|
-
console.error = (...args) => origError(`[${ts()}]`, ...args);
|
|
507
|
-
console.warn = (...args) => origWarn(`[${ts()}]`, ...args);
|
|
508
497
|
running = true;
|
|
509
498
|
if (!options?.skipPidCheck) {
|
|
510
499
|
const alreadyRunning = await handleStalePid();
|
|
@@ -552,6 +541,17 @@ async function startListener(options) {
|
|
|
552
541
|
}
|
|
553
542
|
}
|
|
554
543
|
let pollIntervalMs = 5e3;
|
|
544
|
+
const origLog = console.log.bind(console);
|
|
545
|
+
const origError = console.error.bind(console);
|
|
546
|
+
const origWarn = console.warn.bind(console);
|
|
547
|
+
const ts = () => {
|
|
548
|
+
const d = /* @__PURE__ */ new Date();
|
|
549
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
550
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
551
|
+
};
|
|
552
|
+
console.log = (...args) => origLog(`[${ts()}]`, ...args);
|
|
553
|
+
console.error = (...args) => origError(`[${ts()}]`, ...args);
|
|
554
|
+
console.warn = (...args) => origWarn(`[${ts()}]`, ...args);
|
|
555
555
|
console.log(`RepoWise Listener started \u2014 watching ${allRepoIds.length} repo(s)`);
|
|
556
556
|
const shutdown = async () => {
|
|
557
557
|
console.log("Shutting down...");
|
|
@@ -2443,8 +2443,9 @@ async function logout() {
|
|
|
2443
2443
|
// src/commands/status.ts
|
|
2444
2444
|
import { readFile as readFile9 } from "fs/promises";
|
|
2445
2445
|
import { homedir as homedir9 } from "os";
|
|
2446
|
-
import { join as join13 } from "path";
|
|
2446
|
+
import { basename, join as join13 } from "path";
|
|
2447
2447
|
var STATE_PATH2 = join13(homedir9(), ".repowise", "listener-state.json");
|
|
2448
|
+
var CONFIG_PATH3 = join13(homedir9(), ".repowise", "config.json");
|
|
2448
2449
|
async function status() {
|
|
2449
2450
|
let state = null;
|
|
2450
2451
|
try {
|
|
@@ -2482,11 +2483,22 @@ async function status() {
|
|
|
2482
2483
|
console.log("No sync history. Run `repowise listen` to start syncing.");
|
|
2483
2484
|
return;
|
|
2484
2485
|
}
|
|
2486
|
+
const repoNames = /* @__PURE__ */ new Map();
|
|
2487
|
+
try {
|
|
2488
|
+
const configData = await readFile9(CONFIG_PATH3, "utf-8");
|
|
2489
|
+
const config2 = JSON.parse(configData);
|
|
2490
|
+
for (const repo of config2.repos ?? []) {
|
|
2491
|
+
repoNames.set(repo.repoId, basename(repo.localPath));
|
|
2492
|
+
}
|
|
2493
|
+
} catch {
|
|
2494
|
+
}
|
|
2485
2495
|
console.log("Watched Repos:");
|
|
2486
2496
|
for (const [repoId, repoState] of Object.entries(state.repos)) {
|
|
2497
|
+
const name = repoNames.get(repoId);
|
|
2498
|
+
const label = name ? `${name} (${repoId.slice(0, 8)})` : repoId;
|
|
2487
2499
|
const syncTime = repoState.lastSyncTimestamp ? new Date(repoState.lastSyncTimestamp).toLocaleString() : "never";
|
|
2488
2500
|
const commit = repoState.lastSyncCommitSha ? repoState.lastSyncCommitSha.slice(0, 7) : "none";
|
|
2489
|
-
console.log(` ${
|
|
2501
|
+
console.log(` ${label}: last sync ${syncTime} (commit: ${commit})`);
|
|
2490
2502
|
}
|
|
2491
2503
|
}
|
|
2492
2504
|
|