socket 1.0.37 → 1.0.38
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/cli.js +33 -2
- package/dist/cli.js.map +1 -1
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/types/commands/fix/agent-fix.d.mts.map +1 -1
- package/dist/types/commands/fix/git.d.mts +2 -0
- package/dist/types/commands/fix/git.d.mts.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3096,7 +3096,22 @@ async function gitCleanFdx(cwd = process.cwd()) {
|
|
|
3096
3096
|
// TODO: propagate CResult?
|
|
3097
3097
|
await spawn.spawn('git', ['clean', '-fdx'], stdioIgnoreOptions);
|
|
3098
3098
|
}
|
|
3099
|
+
async function gitCheckoutBranch(branch, cwd = process.cwd()) {
|
|
3100
|
+
const stdioIgnoreOptions = {
|
|
3101
|
+
cwd,
|
|
3102
|
+
stdio: debug.isDebug('stdio') ? 'inherit' : 'ignore'
|
|
3103
|
+
};
|
|
3104
|
+
try {
|
|
3105
|
+
await spawn.spawn('git', ['checkout', branch], stdioIgnoreOptions);
|
|
3106
|
+
return true;
|
|
3107
|
+
} catch {}
|
|
3108
|
+
return false;
|
|
3109
|
+
}
|
|
3099
3110
|
async function gitCreateAndPushBranch(branch, commitMsg, filepaths, options) {
|
|
3111
|
+
if (!filepaths.length) {
|
|
3112
|
+
debug.debugFn('notice', `miss: no filepaths to add`);
|
|
3113
|
+
return false;
|
|
3114
|
+
}
|
|
3100
3115
|
const {
|
|
3101
3116
|
cwd = process.cwd(),
|
|
3102
3117
|
// Lazily access constants.ENV.SOCKET_CLI_GIT_USER_EMAIL.
|
|
@@ -3124,9 +3139,17 @@ async function gitCreateAndPushBranch(branch, commitMsg, filepaths, options) {
|
|
|
3124
3139
|
error: e
|
|
3125
3140
|
});
|
|
3126
3141
|
}
|
|
3142
|
+
return false;
|
|
3143
|
+
}
|
|
3144
|
+
async function gitDeleteBranch(branch, cwd = process.cwd()) {
|
|
3145
|
+
const stdioIgnoreOptions = {
|
|
3146
|
+
cwd,
|
|
3147
|
+
stdio: debug.isDebug('stdio') ? 'inherit' : 'ignore'
|
|
3148
|
+
};
|
|
3127
3149
|
try {
|
|
3128
3150
|
// Will throw with exit code 1 if branch does not exist.
|
|
3129
3151
|
await spawn.spawn('git', ['branch', '-D', branch], stdioIgnoreOptions);
|
|
3152
|
+
return true;
|
|
3130
3153
|
} catch {}
|
|
3131
3154
|
return false;
|
|
3132
3155
|
}
|
|
@@ -4029,6 +4052,8 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4029
4052
|
if (fixEnv.isCi) {
|
|
4030
4053
|
// eslint-disable-next-line no-await-in-loop
|
|
4031
4054
|
await gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
4055
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4056
|
+
await gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
4032
4057
|
}
|
|
4033
4058
|
continue infosLoop;
|
|
4034
4059
|
}
|
|
@@ -4094,6 +4119,10 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4094
4119
|
// eslint-disable-next-line no-await-in-loop
|
|
4095
4120
|
await gitResetAndClean(fixEnv.baseBranch, cwd);
|
|
4096
4121
|
// eslint-disable-next-line no-await-in-loop
|
|
4122
|
+
await gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
4123
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4124
|
+
await gitDeleteBranch(branch, cwd);
|
|
4125
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4097
4126
|
const maybeActualTree = await installer(pkgEnvDetails, {
|
|
4098
4127
|
cwd,
|
|
4099
4128
|
spinner
|
|
@@ -4150,7 +4179,9 @@ async function agentFix(pkgEnvDetails, actualTree, alertsMap, installer, {
|
|
|
4150
4179
|
if (fixEnv.isCi) {
|
|
4151
4180
|
spinner?.start();
|
|
4152
4181
|
// eslint-disable-next-line no-await-in-loop
|
|
4153
|
-
await gitResetAndClean(
|
|
4182
|
+
await gitResetAndClean(branch, cwd);
|
|
4183
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4184
|
+
await gitCheckoutBranch(fixEnv.baseBranch, cwd);
|
|
4154
4185
|
// eslint-disable-next-line no-await-in-loop
|
|
4155
4186
|
const maybeActualTree = await installer(pkgEnvDetails, {
|
|
4156
4187
|
cwd,
|
|
@@ -14262,5 +14293,5 @@ void (async () => {
|
|
|
14262
14293
|
await utils.captureException(e);
|
|
14263
14294
|
}
|
|
14264
14295
|
})();
|
|
14265
|
-
//# debugId=
|
|
14296
|
+
//# debugId=cb6e977b-e9db-4f34-bf64-f5a47c14882c
|
|
14266
14297
|
//# sourceMappingURL=cli.js.map
|