plugin-updater 1.0.17 → 1.0.19
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/index.js +9 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import os from 'os';
|
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
5
|
|
|
6
6
|
let EARLY_LAUNCH_CONFIG_DIR = null;
|
|
7
|
+
const START_TIME = new Date().toISOString().replace(/:/g, '-').split('.')[0];
|
|
7
8
|
|
|
8
9
|
function getAppConfigDir(appName) {
|
|
9
10
|
if (EARLY_LAUNCH_CONFIG_DIR) {
|
|
@@ -19,7 +20,6 @@ function writeLog(message, isError = false) {
|
|
|
19
20
|
try {
|
|
20
21
|
const date = new Date();
|
|
21
22
|
const dateStr = date.toISOString().split('T')[0];
|
|
22
|
-
const timeStr = date.toISOString().replace(/:/g, '-').split('.')[0];
|
|
23
23
|
const isClaude = process.argv.join(' ').includes('claude');
|
|
24
24
|
const appName = isClaude ? "claude" : "opencode";
|
|
25
25
|
const configDir = getAppConfigDir(appName);
|
|
@@ -29,7 +29,7 @@ function writeLog(message, isError = false) {
|
|
|
29
29
|
fs.mkdirSync(logsDir, { recursive: true });
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const logFile = path.join(logsDir, `updater-${
|
|
32
|
+
const logFile = path.join(logsDir, `updater-${START_TIME}.log`);
|
|
33
33
|
const prefix = isError ? "[ERROR]" : "[INFO]";
|
|
34
34
|
const logMsg = `[${date.toISOString()}] ${prefix} ${message}\n`;
|
|
35
35
|
|
|
@@ -49,10 +49,15 @@ function getReposDir() {
|
|
|
49
49
|
function executeGit(command, cwd) {
|
|
50
50
|
writeLog(`Executing git: ${command} in ${cwd}`);
|
|
51
51
|
try {
|
|
52
|
-
execSync(command, {
|
|
52
|
+
execSync(command, {
|
|
53
|
+
cwd,
|
|
54
|
+
stdio: "pipe",
|
|
55
|
+
env: { ...process.env, GCM_INTERACTIVE: 'never', GIT_TERMINAL_PROMPT: '0' }
|
|
56
|
+
});
|
|
53
57
|
return true;
|
|
54
58
|
} catch (error) {
|
|
55
|
-
|
|
59
|
+
const stderr = error.stderr ? error.stderr.toString().trim() : '';
|
|
60
|
+
writeLog(`Git error in ${cwd}: ${error.message} | stderr: ${stderr}`, true);
|
|
56
61
|
return false;
|
|
57
62
|
}
|
|
58
63
|
}
|