deepdebug-local-agent 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/package.json +1 -1
- package/src/exec-utils.js +39 -21
- package/src/server.js +448 -241
package/package.json
CHANGED
package/src/exec-utils.js
CHANGED
|
@@ -47,20 +47,38 @@ export function run(cmd, args, cwd, timeoutMs = 10 * 60 * 1000) {
|
|
|
47
47
|
* @returns {Promise<{code: number, stdout: string, stderr: string, duration: number}>}
|
|
48
48
|
*/
|
|
49
49
|
export async function compileAndTest({ language, buildTool, cwd, skipTests = false }) {
|
|
50
|
-
console.log(
|
|
50
|
+
console.log(`[BUILD] [COMPILE] Language: ${language}, BuildTool: ${buildTool}, SkipTests: ${skipTests}`);
|
|
51
51
|
|
|
52
52
|
let result;
|
|
53
53
|
const start = Date.now();
|
|
54
54
|
|
|
55
55
|
try {
|
|
56
56
|
if (language === "java" && buildTool === "maven") {
|
|
57
|
-
//
|
|
57
|
+
// Prefer ./mvnw wrapper over system mvn
|
|
58
|
+
const fs = await import("fs");
|
|
59
|
+
const path = await import("path");
|
|
60
|
+
const hasMvnw = fs.existsSync(path.join(cwd, "mvnw"));
|
|
61
|
+
const mvnCmd = hasMvnw ? "./mvnw" : "mvn";
|
|
62
|
+
|
|
63
|
+
// Verify build tool is available before attempting
|
|
64
|
+
if (!hasMvnw) {
|
|
65
|
+
const check = await run("which mvn", [], cwd);
|
|
66
|
+
if (check.code !== 0) {
|
|
67
|
+
return {
|
|
68
|
+
code: 1,
|
|
69
|
+
stdout: "",
|
|
70
|
+
stderr: "Maven not found: neither ./mvnw nor mvn is available in this environment.",
|
|
71
|
+
duration: Date.now() - start
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
58
76
|
const args = skipTests
|
|
59
|
-
? ["
|
|
60
|
-
: ["
|
|
77
|
+
? ["compile", "-q", "-DskipTests"]
|
|
78
|
+
: ["test", "-q"];
|
|
61
79
|
|
|
62
|
-
console.log(
|
|
63
|
-
result = await run(
|
|
80
|
+
console.log(`[BUILD] [COMPILE] Running: ${mvnCmd} ${args.join(" ")}`);
|
|
81
|
+
result = await run(mvnCmd, args, cwd);
|
|
64
82
|
}
|
|
65
83
|
else if (language === "java" && buildTool === "gradle") {
|
|
66
84
|
// Gradle: clean build
|
|
@@ -68,12 +86,12 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
68
86
|
? ["clean", "build", "-x", "test"]
|
|
69
87
|
: ["clean", "build"];
|
|
70
88
|
|
|
71
|
-
console.log(
|
|
89
|
+
console.log(`[BUILD] [COMPILE] Running: ./gradlew ${args.join(" ")}`);
|
|
72
90
|
result = await run("./gradlew", args, cwd);
|
|
73
91
|
}
|
|
74
92
|
else if (language === "node" || buildTool === "npm") {
|
|
75
93
|
// Node/npm: install and optionally test
|
|
76
|
-
console.log(
|
|
94
|
+
console.log(`[BUILD] [COMPILE] Running: npm install`);
|
|
77
95
|
const installResult = await run("npm", ["install", "--silent"], cwd);
|
|
78
96
|
|
|
79
97
|
if (installResult.code !== 0) {
|
|
@@ -81,7 +99,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
81
99
|
}
|
|
82
100
|
|
|
83
101
|
if (!skipTests) {
|
|
84
|
-
console.log(
|
|
102
|
+
console.log(`[BUILD] [COMPILE] Running: npm test`);
|
|
85
103
|
result = await run("npm", ["test", "--silent"], cwd);
|
|
86
104
|
} else {
|
|
87
105
|
result = installResult;
|
|
@@ -89,7 +107,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
89
107
|
}
|
|
90
108
|
else if (language === "node" || buildTool === "yarn") {
|
|
91
109
|
// Yarn
|
|
92
|
-
console.log(
|
|
110
|
+
console.log(`[BUILD] [COMPILE] Running: yarn install`);
|
|
93
111
|
const installResult = await run("yarn", ["install", "--silent"], cwd);
|
|
94
112
|
|
|
95
113
|
if (installResult.code !== 0) {
|
|
@@ -97,7 +115,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
if (!skipTests) {
|
|
100
|
-
console.log(
|
|
118
|
+
console.log(`[BUILD] [COMPILE] Running: yarn test`);
|
|
101
119
|
result = await run("yarn", ["test", "--silent"], cwd);
|
|
102
120
|
} else {
|
|
103
121
|
result = installResult;
|
|
@@ -106,7 +124,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
106
124
|
else if (language === "python") {
|
|
107
125
|
// Python: pytest
|
|
108
126
|
if (!skipTests) {
|
|
109
|
-
console.log(
|
|
127
|
+
console.log(`[BUILD] [COMPILE] Running: pytest`);
|
|
110
128
|
result = await run("pytest", [], cwd);
|
|
111
129
|
} else {
|
|
112
130
|
// Python doesn't have a compile step, just return success
|
|
@@ -115,7 +133,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
115
133
|
}
|
|
116
134
|
else if (language === "go") {
|
|
117
135
|
// Go: build and optionally test
|
|
118
|
-
console.log(
|
|
136
|
+
console.log(`[BUILD] [COMPILE] Running: go build ./...`);
|
|
119
137
|
const buildResult = await run("go", ["build", "./..."], cwd);
|
|
120
138
|
|
|
121
139
|
if (buildResult.code !== 0) {
|
|
@@ -123,7 +141,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
123
141
|
}
|
|
124
142
|
|
|
125
143
|
if (!skipTests) {
|
|
126
|
-
console.log(
|
|
144
|
+
console.log(`[BUILD] [COMPILE] Running: go test ./...`);
|
|
127
145
|
result = await run("go", ["test", "./..."], cwd);
|
|
128
146
|
} else {
|
|
129
147
|
result = buildResult;
|
|
@@ -131,7 +149,7 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
131
149
|
}
|
|
132
150
|
else if (language === ".net" || language === "dotnet") {
|
|
133
151
|
// .NET: build and optionally test
|
|
134
|
-
console.log(
|
|
152
|
+
console.log(`[BUILD] [COMPILE] Running: dotnet build`);
|
|
135
153
|
const buildResult = await run("dotnet", ["build"], cwd);
|
|
136
154
|
|
|
137
155
|
if (buildResult.code !== 0) {
|
|
@@ -139,14 +157,14 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
139
157
|
}
|
|
140
158
|
|
|
141
159
|
if (!skipTests) {
|
|
142
|
-
console.log(
|
|
160
|
+
console.log(`[BUILD] [COMPILE] Running: dotnet test`);
|
|
143
161
|
result = await run("dotnet", ["test"], cwd);
|
|
144
162
|
} else {
|
|
145
163
|
result = buildResult;
|
|
146
164
|
}
|
|
147
165
|
}
|
|
148
166
|
else {
|
|
149
|
-
console.error(
|
|
167
|
+
console.error(`[ERR] [COMPILE] Unsupported: ${language}/${buildTool}`);
|
|
150
168
|
return {
|
|
151
169
|
code: 1,
|
|
152
170
|
stdout: "",
|
|
@@ -157,18 +175,18 @@ export async function compileAndTest({ language, buildTool, cwd, skipTests = fal
|
|
|
157
175
|
|
|
158
176
|
// Log result
|
|
159
177
|
if (result.code === 0) {
|
|
160
|
-
console.log(
|
|
178
|
+
console.log(`[OK] [COMPILE] Success in ${result.duration}ms`);
|
|
161
179
|
} else {
|
|
162
|
-
console.error(
|
|
180
|
+
console.error(`[ERR] [COMPILE] Failed with code ${result.code}`);
|
|
163
181
|
if (result.stderr) {
|
|
164
|
-
console.error(
|
|
182
|
+
console.error(`[ERR] [COMPILE] Error: ${result.stderr.substring(0, 500)}`);
|
|
165
183
|
}
|
|
166
184
|
}
|
|
167
185
|
|
|
168
186
|
return result;
|
|
169
187
|
|
|
170
188
|
} catch (err) {
|
|
171
|
-
console.error(
|
|
189
|
+
console.error(`[ERR] [COMPILE] Exception: ${err.message}`);
|
|
172
190
|
return {
|
|
173
191
|
code: 1,
|
|
174
192
|
stdout: "",
|