@xdevops/issue-auto-finish 1.0.78 → 1.0.80
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/{analyze-IZFTWCNR.js → analyze-MIYHVC2A.js} +2 -2
- package/dist/{braindump-SXLAURR4.js → braindump-JNET2EEP.js} +2 -2
- package/dist/{chunk-M4AHOHAG.js → chunk-CUZCZUMA.js} +65 -40
- package/dist/chunk-CUZCZUMA.js.map +1 -0
- package/dist/{chunk-N4WSNLIU.js → chunk-FE5FQPF4.js} +3 -3
- package/dist/{chunk-OOJNTGB5.js → chunk-PNTEPUOH.js} +2 -2
- package/dist/chunk-PNTEPUOH.js.map +1 -0
- package/dist/{chunk-JL6ALTPS.js → chunk-RJUOVI3J.js} +5 -5
- package/dist/{chunk-VYNKAT4P.js → chunk-UAINLCSR.js} +2 -2
- package/dist/{chunk-4D5YULKB.js → chunk-ZZ4DRTBE.js} +26 -4
- package/dist/chunk-ZZ4DRTBE.js.map +1 -0
- package/dist/cli.js +6 -6
- package/dist/{config-LLOHFS6J.js → config-E7XKQUSH.js} +2 -2
- package/dist/deploy/DevServerManager.d.ts +2 -0
- package/dist/deploy/DevServerManager.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/{init-EQWSE5FX.js → init-E4KZDZE2.js} +4 -4
- package/dist/lib.js +2 -2
- package/dist/orchestrator/PipelineOrchestrator.d.ts.map +1 -1
- package/dist/orchestrator/steps/FailureHandler.d.ts.map +1 -1
- package/dist/{restart-6FZSY2HS.js → restart-XK7ND7O3.js} +4 -4
- package/dist/run.js +5 -5
- package/dist/{start-72FLCNB5.js → start-5MMXJY3P.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-4D5YULKB.js.map +0 -1
- package/dist/chunk-M4AHOHAG.js.map +0 -1
- package/dist/chunk-OOJNTGB5.js.map +0 -1
- /package/dist/{analyze-IZFTWCNR.js.map → analyze-MIYHVC2A.js.map} +0 -0
- /package/dist/{braindump-SXLAURR4.js.map → braindump-JNET2EEP.js.map} +0 -0
- /package/dist/{chunk-N4WSNLIU.js.map → chunk-FE5FQPF4.js.map} +0 -0
- /package/dist/{chunk-JL6ALTPS.js.map → chunk-RJUOVI3J.js.map} +0 -0
- /package/dist/{chunk-VYNKAT4P.js.map → chunk-UAINLCSR.js.map} +0 -0
- /package/dist/{config-LLOHFS6J.js.map → config-E7XKQUSH.js.map} +0 -0
- /package/dist/{init-EQWSE5FX.js.map → init-E4KZDZE2.js.map} +0 -0
- /package/dist/{restart-6FZSY2HS.js.map → restart-XK7ND7O3.js.map} +0 -0
- /package/dist/{start-72FLCNB5.js.map → start-5MMXJY3P.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PNTEPUOH.js";
|
|
4
4
|
import "./chunk-AKXDQH25.js";
|
|
5
5
|
import {
|
|
6
6
|
analyze
|
|
@@ -73,4 +73,4 @@ async function analyzeCommand(opts) {
|
|
|
73
73
|
export {
|
|
74
74
|
analyzeCommand
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=analyze-
|
|
76
|
+
//# sourceMappingURL=analyze-MIYHVC2A.js.map
|
|
@@ -18,7 +18,7 @@ import "./chunk-ACVOOHAR.js";
|
|
|
18
18
|
import "./chunk-KWODU7HB.js";
|
|
19
19
|
import {
|
|
20
20
|
loadConfig
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PNTEPUOH.js";
|
|
22
22
|
import "./chunk-AKXDQH25.js";
|
|
23
23
|
import "./chunk-B7TVVODN.js";
|
|
24
24
|
import "./chunk-TN2SYADO.js";
|
|
@@ -205,4 +205,4 @@ ${bold("\u786E\u8BA4\u6267\u884C\uFF1F")} (${green("y")}=\u786E\u8BA4 / ${red("q
|
|
|
205
205
|
export {
|
|
206
206
|
braindumpCommand
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=braindump-
|
|
208
|
+
//# sourceMappingURL=braindump-JNET2EEP.js.map
|
|
@@ -2987,7 +2987,7 @@ var WorkspaceManager = class {
|
|
|
2987
2987
|
|
|
2988
2988
|
// src/orchestrator/PipelineOrchestrator.ts
|
|
2989
2989
|
import path13 from "path";
|
|
2990
|
-
import
|
|
2990
|
+
import fs12 from "fs/promises";
|
|
2991
2991
|
import fsSync from "fs";
|
|
2992
2992
|
import { execFile as execFile2 } from "child_process";
|
|
2993
2993
|
import { promisify as promisify2 } from "util";
|
|
@@ -3169,15 +3169,15 @@ var PortAllocator = class {
|
|
|
3169
3169
|
|
|
3170
3170
|
// src/deploy/DevServerManager.ts
|
|
3171
3171
|
import { spawn } from "child_process";
|
|
3172
|
+
import fs10 from "fs";
|
|
3172
3173
|
import path11 from "path";
|
|
3173
|
-
import
|
|
3174
|
-
import http from "http";
|
|
3174
|
+
import net2 from "net";
|
|
3175
3175
|
var logger12 = logger.child("DevServerManager");
|
|
3176
3176
|
var DEFAULT_OPTIONS2 = {
|
|
3177
3177
|
healthCheckTimeoutMs: 12e4,
|
|
3178
3178
|
healthCheckIntervalMs: 3e3
|
|
3179
3179
|
};
|
|
3180
|
-
function waitForPort(port,
|
|
3180
|
+
function waitForPort(port, timeoutMs, intervalMs) {
|
|
3181
3181
|
return new Promise((resolve, reject) => {
|
|
3182
3182
|
const deadline = Date.now() + timeoutMs;
|
|
3183
3183
|
const check = () => {
|
|
@@ -3185,24 +3185,18 @@ function waitForPort(port, useTls, timeoutMs, intervalMs) {
|
|
|
3185
3185
|
reject(new Error(`Port ${port} not ready after ${timeoutMs}ms`));
|
|
3186
3186
|
return;
|
|
3187
3187
|
}
|
|
3188
|
-
const
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
)
|
|
3195
|
-
|
|
3196
|
-
(res) => {
|
|
3197
|
-
res.resume();
|
|
3198
|
-
resolve();
|
|
3199
|
-
}
|
|
3200
|
-
);
|
|
3201
|
-
req.on("error", () => {
|
|
3188
|
+
const socket = net2.createConnection({ host: "127.0.0.1", port });
|
|
3189
|
+
socket.setTimeout(5e3);
|
|
3190
|
+
socket.on("connect", () => {
|
|
3191
|
+
socket.destroy();
|
|
3192
|
+
resolve();
|
|
3193
|
+
});
|
|
3194
|
+
socket.on("error", () => {
|
|
3195
|
+
socket.destroy();
|
|
3202
3196
|
setTimeout(check, intervalMs);
|
|
3203
3197
|
});
|
|
3204
|
-
|
|
3205
|
-
|
|
3198
|
+
socket.on("timeout", () => {
|
|
3199
|
+
socket.destroy();
|
|
3206
3200
|
setTimeout(check, intervalMs);
|
|
3207
3201
|
});
|
|
3208
3202
|
};
|
|
@@ -3212,8 +3206,17 @@ function waitForPort(port, useTls, timeoutMs, intervalMs) {
|
|
|
3212
3206
|
var DevServerManager = class {
|
|
3213
3207
|
servers = /* @__PURE__ */ new Map();
|
|
3214
3208
|
options;
|
|
3209
|
+
logDir;
|
|
3215
3210
|
constructor(options) {
|
|
3216
3211
|
this.options = { ...DEFAULT_OPTIONS2, ...options };
|
|
3212
|
+
this.logDir = path11.join(resolveDataDir(), "preview-logs");
|
|
3213
|
+
if (!fs10.existsSync(this.logDir)) {
|
|
3214
|
+
fs10.mkdirSync(this.logDir, { recursive: true });
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
getLogPath(issueIid, type) {
|
|
3218
|
+
const filePath = path11.join(this.logDir, `${issueIid}-${type}.log`);
|
|
3219
|
+
return fs10.existsSync(filePath) ? filePath : null;
|
|
3217
3220
|
}
|
|
3218
3221
|
async startServers(wtCtx, ports) {
|
|
3219
3222
|
if (this.servers.has(wtCtx.issueIid)) {
|
|
@@ -3221,6 +3224,12 @@ var DevServerManager = class {
|
|
|
3221
3224
|
return;
|
|
3222
3225
|
}
|
|
3223
3226
|
logger12.info("Starting dev servers", { issueIid: wtCtx.issueIid, ...ports });
|
|
3227
|
+
const backendLogPath = path11.join(this.logDir, `${wtCtx.issueIid}-backend.log`);
|
|
3228
|
+
const frontendLogPath = path11.join(this.logDir, `${wtCtx.issueIid}-frontend.log`);
|
|
3229
|
+
const backendLog = fs10.createWriteStream(backendLogPath, { flags: "a" });
|
|
3230
|
+
const frontendLog = fs10.createWriteStream(frontendLogPath, { flags: "a" });
|
|
3231
|
+
const tsLine = (stream, data) => `[${(/* @__PURE__ */ new Date()).toISOString()}] [${stream}] ${data.toString().trimEnd()}
|
|
3232
|
+
`;
|
|
3224
3233
|
const backendEnv = {
|
|
3225
3234
|
...process.env,
|
|
3226
3235
|
PORT: String(ports.backendPort),
|
|
@@ -3232,13 +3241,14 @@ var DevServerManager = class {
|
|
|
3232
3241
|
cwd: wtCtx.workDir,
|
|
3233
3242
|
env: backendEnv,
|
|
3234
3243
|
stdio: ["ignore", "pipe", "pipe"],
|
|
3235
|
-
detached:
|
|
3244
|
+
detached: true
|
|
3236
3245
|
});
|
|
3246
|
+
backend.unref();
|
|
3237
3247
|
backend.stdout?.on("data", (data) => {
|
|
3238
|
-
|
|
3248
|
+
backendLog.write(tsLine("stdout", data));
|
|
3239
3249
|
});
|
|
3240
3250
|
backend.stderr?.on("data", (data) => {
|
|
3241
|
-
|
|
3251
|
+
backendLog.write(tsLine("stderr", data));
|
|
3242
3252
|
});
|
|
3243
3253
|
backend.on("exit", (code) => {
|
|
3244
3254
|
logger12.info("Backend process exited", { issueIid: wtCtx.issueIid, code });
|
|
@@ -3255,13 +3265,14 @@ var DevServerManager = class {
|
|
|
3255
3265
|
cwd: frontendDir,
|
|
3256
3266
|
env: frontendEnv,
|
|
3257
3267
|
stdio: ["ignore", "pipe", "pipe"],
|
|
3258
|
-
detached:
|
|
3268
|
+
detached: true
|
|
3259
3269
|
});
|
|
3270
|
+
frontend.unref();
|
|
3260
3271
|
frontend.stdout?.on("data", (data) => {
|
|
3261
|
-
|
|
3272
|
+
frontendLog.write(tsLine("stdout", data));
|
|
3262
3273
|
});
|
|
3263
3274
|
frontend.stderr?.on("data", (data) => {
|
|
3264
|
-
|
|
3275
|
+
frontendLog.write(tsLine("stderr", data));
|
|
3265
3276
|
});
|
|
3266
3277
|
frontend.on("exit", (code) => {
|
|
3267
3278
|
logger12.info("Frontend process exited", { issueIid: wtCtx.issueIid, code });
|
|
@@ -3271,7 +3282,9 @@ var DevServerManager = class {
|
|
|
3271
3282
|
frontend,
|
|
3272
3283
|
ports,
|
|
3273
3284
|
workDir: wtCtx.workDir,
|
|
3274
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3285
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3286
|
+
backendLog,
|
|
3287
|
+
frontendLog
|
|
3275
3288
|
};
|
|
3276
3289
|
this.servers.set(wtCtx.issueIid, serverSet);
|
|
3277
3290
|
logger12.info("Waiting for servers to become healthy", { issueIid: wtCtx.issueIid });
|
|
@@ -3279,13 +3292,11 @@ var DevServerManager = class {
|
|
|
3279
3292
|
await Promise.all([
|
|
3280
3293
|
waitForPort(
|
|
3281
3294
|
ports.backendPort,
|
|
3282
|
-
false,
|
|
3283
3295
|
this.options.healthCheckTimeoutMs,
|
|
3284
3296
|
this.options.healthCheckIntervalMs
|
|
3285
3297
|
),
|
|
3286
3298
|
waitForPort(
|
|
3287
3299
|
ports.frontendPort,
|
|
3288
|
-
true,
|
|
3289
3300
|
this.options.healthCheckTimeoutMs,
|
|
3290
3301
|
this.options.healthCheckIntervalMs
|
|
3291
3302
|
)
|
|
@@ -3306,6 +3317,8 @@ var DevServerManager = class {
|
|
|
3306
3317
|
logger12.info("Stopping dev servers", { issueIid, ports: set.ports });
|
|
3307
3318
|
killProcess(set.backend, `backend #${issueIid}`);
|
|
3308
3319
|
killProcess(set.frontend, `frontend #${issueIid}`);
|
|
3320
|
+
set.backendLog.end();
|
|
3321
|
+
set.frontendLog.end();
|
|
3309
3322
|
this.servers.delete(issueIid);
|
|
3310
3323
|
}
|
|
3311
3324
|
stopAll() {
|
|
@@ -3329,11 +3342,21 @@ var DevServerManager = class {
|
|
|
3329
3342
|
function killProcess(proc, label) {
|
|
3330
3343
|
try {
|
|
3331
3344
|
if (proc.killed || proc.exitCode !== null) return;
|
|
3332
|
-
proc.
|
|
3345
|
+
const pid = proc.pid;
|
|
3346
|
+
if (!pid) return;
|
|
3347
|
+
try {
|
|
3348
|
+
process.kill(-pid, "SIGTERM");
|
|
3349
|
+
} catch {
|
|
3350
|
+
proc.kill("SIGTERM");
|
|
3351
|
+
}
|
|
3333
3352
|
setTimeout(() => {
|
|
3334
3353
|
if (!proc.killed && proc.exitCode === null) {
|
|
3335
3354
|
logger12.warn(`Force killing ${label}`);
|
|
3336
|
-
|
|
3355
|
+
try {
|
|
3356
|
+
process.kill(-pid, "SIGKILL");
|
|
3357
|
+
} catch {
|
|
3358
|
+
proc.kill("SIGKILL");
|
|
3359
|
+
}
|
|
3337
3360
|
}
|
|
3338
3361
|
}, 5e3);
|
|
3339
3362
|
} catch (err) {
|
|
@@ -3356,12 +3379,12 @@ function isE2eEnabledForIssue(issueIid, tracker, cfg) {
|
|
|
3356
3379
|
}
|
|
3357
3380
|
|
|
3358
3381
|
// src/e2e/ScreenshotCollector.ts
|
|
3359
|
-
import
|
|
3382
|
+
import fs11 from "fs";
|
|
3360
3383
|
import path12 from "path";
|
|
3361
3384
|
var logger13 = logger.child("ScreenshotCollector");
|
|
3362
3385
|
var MAX_SCREENSHOTS = 20;
|
|
3363
3386
|
function walkDir(dir, files = []) {
|
|
3364
|
-
for (const entry of
|
|
3387
|
+
for (const entry of fs11.readdirSync(dir, { withFileTypes: true })) {
|
|
3365
3388
|
const full = path12.join(dir, entry.name);
|
|
3366
3389
|
if (entry.isDirectory()) {
|
|
3367
3390
|
walkDir(full, files);
|
|
@@ -3373,7 +3396,7 @@ function walkDir(dir, files = []) {
|
|
|
3373
3396
|
}
|
|
3374
3397
|
function collectScreenshots(workDir) {
|
|
3375
3398
|
const testResultsDir = path12.join(workDir, "frontend", "test-results");
|
|
3376
|
-
if (!
|
|
3399
|
+
if (!fs11.existsSync(testResultsDir)) {
|
|
3377
3400
|
logger13.debug("test-results directory not found", { dir: testResultsDir });
|
|
3378
3401
|
return [];
|
|
3379
3402
|
}
|
|
@@ -4068,6 +4091,7 @@ async function handleFailure(err, issue, wtCtx, deps) {
|
|
|
4068
4091
|
});
|
|
4069
4092
|
}
|
|
4070
4093
|
}
|
|
4094
|
+
deps.stopPreviewServers(issue.iid);
|
|
4071
4095
|
const preservedDirs = wtCtx.workspace ? [wtCtx.workspace.primary.gitRootDir, ...wtCtx.workspace.associates.map((a) => a.gitRootDir)] : [wtCtx.gitRootDir];
|
|
4072
4096
|
logger18.info("Worktree(s) preserved for debugging", {
|
|
4073
4097
|
primary: wtCtx.gitRootDir,
|
|
@@ -4173,7 +4197,7 @@ var PipelineOrchestrator = class {
|
|
|
4173
4197
|
try {
|
|
4174
4198
|
const gitFile = path13.join(wtDir, ".git");
|
|
4175
4199
|
try {
|
|
4176
|
-
await
|
|
4200
|
+
await fs12.access(gitFile);
|
|
4177
4201
|
} catch {
|
|
4178
4202
|
logger19.warn("Worktree corrupted (.git missing), force removing", { dir: wtDir });
|
|
4179
4203
|
await this.mainGit.worktreeRemove(wtDir, true).catch(() => {
|
|
@@ -4190,7 +4214,7 @@ var PipelineOrchestrator = class {
|
|
|
4190
4214
|
}
|
|
4191
4215
|
const indexLock = path13.join(wtDir, ".git", "index.lock");
|
|
4192
4216
|
try {
|
|
4193
|
-
await
|
|
4217
|
+
await fs12.unlink(indexLock);
|
|
4194
4218
|
logger19.warn("Removed stale index.lock", { path: indexLock });
|
|
4195
4219
|
cleaned++;
|
|
4196
4220
|
} catch {
|
|
@@ -4204,7 +4228,7 @@ var PipelineOrchestrator = class {
|
|
|
4204
4228
|
}
|
|
4205
4229
|
const mainIndexLock = path13.join(repoGitRoot, ".git", "index.lock");
|
|
4206
4230
|
try {
|
|
4207
|
-
await
|
|
4231
|
+
await fs12.unlink(mainIndexLock);
|
|
4208
4232
|
logger19.warn("Removed stale main repo index.lock", { path: mainIndexLock });
|
|
4209
4233
|
cleaned++;
|
|
4210
4234
|
} catch {
|
|
@@ -4310,7 +4334,7 @@ var PipelineOrchestrator = class {
|
|
|
4310
4334
|
async ensureNodeModules(workDir) {
|
|
4311
4335
|
const targetBin = path13.join(workDir, "node_modules", ".bin");
|
|
4312
4336
|
try {
|
|
4313
|
-
await
|
|
4337
|
+
await fs12.access(targetBin);
|
|
4314
4338
|
logger19.info("node_modules already complete (has .bin/)");
|
|
4315
4339
|
return true;
|
|
4316
4340
|
} catch {
|
|
@@ -4318,7 +4342,7 @@ var PipelineOrchestrator = class {
|
|
|
4318
4342
|
const sourceNM = path13.join(this.config.project.workDir, "node_modules");
|
|
4319
4343
|
const targetNM = path13.join(workDir, "node_modules");
|
|
4320
4344
|
try {
|
|
4321
|
-
await
|
|
4345
|
+
await fs12.access(sourceNM);
|
|
4322
4346
|
} catch {
|
|
4323
4347
|
logger19.warn("Main repo node_modules not found, skipping seed", { sourceNM });
|
|
4324
4348
|
return false;
|
|
@@ -4706,6 +4730,7 @@ E2E \u6D4B\u8BD5\u5C06\u5C1D\u8BD5\u4F7F\u7528 config.json \u4E2D\u7684\u9ED8\u8
|
|
|
4706
4730
|
if (!fsSync.existsSync(wtCtx.workDir)) {
|
|
4707
4731
|
throw new InvalidStateError(record.state, "Worktree no longer exists");
|
|
4708
4732
|
}
|
|
4733
|
+
this.stopPreviewServers(issueIid);
|
|
4709
4734
|
const ports = await this.portAllocator.allocate(issueIid);
|
|
4710
4735
|
wtCtx.ports = ports;
|
|
4711
4736
|
try {
|
|
@@ -5120,4 +5145,4 @@ export {
|
|
|
5120
5145
|
PipelineOrchestrator,
|
|
5121
5146
|
BrainstormService
|
|
5122
5147
|
};
|
|
5123
|
-
//# sourceMappingURL=chunk-
|
|
5148
|
+
//# sourceMappingURL=chunk-CUZCZUMA.js.map
|