git-watchtower 1.11.8 → 1.11.10
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/git-watchtower.js +15 -2
- package/package.json +1 -1
- package/src/git/commands.js +4 -13
package/bin/git-watchtower.js
CHANGED
|
@@ -448,7 +448,11 @@ function applyConfig(config) {
|
|
|
448
448
|
// Server log management
|
|
449
449
|
function addServerLog(line, isError = false) {
|
|
450
450
|
const entry = { timestamp: new Date().toLocaleTimeString(), line, isError };
|
|
451
|
-
const
|
|
451
|
+
const prev = store.get('serverLogBuffer');
|
|
452
|
+
// Drop the oldest entries to stay within MAX_SERVER_LOG_LINES after push
|
|
453
|
+
const startIdx = Math.max(0, prev.length + 1 - MAX_SERVER_LOG_LINES);
|
|
454
|
+
const serverLogBuffer = prev.slice(startIdx);
|
|
455
|
+
serverLogBuffer.push(entry);
|
|
452
456
|
store.setState({ serverLogBuffer });
|
|
453
457
|
}
|
|
454
458
|
|
|
@@ -976,7 +980,12 @@ function addLog(message, type = 'info') {
|
|
|
976
980
|
icon: icons[type] || '○',
|
|
977
981
|
color: colors[type] || 'white',
|
|
978
982
|
};
|
|
979
|
-
const
|
|
983
|
+
const prev = store.get('activityLog');
|
|
984
|
+
// Drop the oldest entries to stay within MAX_LOG_ENTRIES after prepend
|
|
985
|
+
const keepCount = Math.min(prev.length, MAX_LOG_ENTRIES - 1);
|
|
986
|
+
const activityLog = new Array(keepCount + 1);
|
|
987
|
+
activityLog[0] = entry;
|
|
988
|
+
for (let i = 0; i < keepCount; i++) activityLog[i + 1] = prev[i];
|
|
980
989
|
store.setState({ activityLog });
|
|
981
990
|
}
|
|
982
991
|
|
|
@@ -2221,6 +2230,9 @@ function setupKeyboardInput() {
|
|
|
2221
2230
|
process.stdin.resume();
|
|
2222
2231
|
process.stdin.setEncoding('utf8');
|
|
2223
2232
|
|
|
2233
|
+
// Suppress EIO errors that occur when the PTY is torn down during exit
|
|
2234
|
+
process.stdin.on('error', () => {});
|
|
2235
|
+
|
|
2224
2236
|
process.stdin.on('data', async (key) => {
|
|
2225
2237
|
// Handle search mode input via actions module
|
|
2226
2238
|
if (store.get('searchMode')) {
|
|
@@ -3225,6 +3237,7 @@ async function shutdown() {
|
|
|
3225
3237
|
if (process.stdin.isTTY) {
|
|
3226
3238
|
process.stdin.setRawMode(false);
|
|
3227
3239
|
}
|
|
3240
|
+
process.stdin.pause();
|
|
3228
3241
|
|
|
3229
3242
|
if (fileWatcher) fileWatcher.close();
|
|
3230
3243
|
if (pollIntervalId) clearTimeout(pollIntervalId);
|
package/package.json
CHANGED
package/src/git/commands.js
CHANGED
|
@@ -17,8 +17,7 @@ const SHORT_TIMEOUT = 5000;
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Execute a git command safely using execFile (no shell).
|
|
20
|
-
* @param {string
|
|
21
|
-
* or a legacy command string (e.g. 'git --version') for backwards compatibility
|
|
20
|
+
* @param {string[]} args - Git arguments as an array (e.g. ['log', '--oneline'])
|
|
22
21
|
* @param {Object} [options] - Execution options
|
|
23
22
|
* @param {number} [options.timeout] - Command timeout in ms
|
|
24
23
|
* @param {string} [options.cwd] - Working directory
|
|
@@ -28,16 +27,8 @@ const SHORT_TIMEOUT = 5000;
|
|
|
28
27
|
async function execGit(args, options = {}) {
|
|
29
28
|
const { timeout = DEFAULT_TIMEOUT, cwd = process.cwd() } = options;
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (typeof args === 'string') {
|
|
34
|
-
const parts = /** @type {string} */ (args).split(/\s+/);
|
|
35
|
-
// Strip leading 'git' if present so callers can pass 'git --version'
|
|
36
|
-
if (parts[0] === 'git') {
|
|
37
|
-
args = parts.slice(1);
|
|
38
|
-
} else {
|
|
39
|
-
args = parts;
|
|
40
|
-
}
|
|
30
|
+
if (!Array.isArray(args)) {
|
|
31
|
+
throw new TypeError('execGit: args must be an array of strings');
|
|
41
32
|
}
|
|
42
33
|
|
|
43
34
|
const command = `git ${args.join(' ')}`;
|
|
@@ -72,7 +63,7 @@ async function execGit(args, options = {}) {
|
|
|
72
63
|
|
|
73
64
|
/**
|
|
74
65
|
* Execute git command silently (suppress errors)
|
|
75
|
-
* @param {string
|
|
66
|
+
* @param {string[]} command - Git arguments
|
|
76
67
|
* @param {Object} [options] - Execution options
|
|
77
68
|
* @returns {Promise<{stdout: string, stderr: string}|null>}
|
|
78
69
|
*/
|