Fix debug logging
This commit is contained in:
@@ -406,7 +406,7 @@ var require_tunnel = __commonJS({
|
||||
connectOptions.headers = connectOptions.headers || {};
|
||||
connectOptions.headers["Proxy-Authorization"] = "Basic " + new Buffer(connectOptions.proxyAuth).toString("base64");
|
||||
}
|
||||
debug2("making CONNECT request");
|
||||
debug("making CONNECT request");
|
||||
var connectReq = self2.request(connectOptions);
|
||||
connectReq.useChunkedEncodingByDefault = false;
|
||||
connectReq.once("response", onResponse);
|
||||
@@ -426,7 +426,7 @@ var require_tunnel = __commonJS({
|
||||
connectReq.removeAllListeners();
|
||||
socket.removeAllListeners();
|
||||
if (res.statusCode !== 200) {
|
||||
debug2(
|
||||
debug(
|
||||
"tunneling socket could not be established, statusCode=%d",
|
||||
res.statusCode
|
||||
);
|
||||
@@ -438,7 +438,7 @@ var require_tunnel = __commonJS({
|
||||
return;
|
||||
}
|
||||
if (head.length > 0) {
|
||||
debug2("got illegal response body from proxy");
|
||||
debug("got illegal response body from proxy");
|
||||
socket.destroy();
|
||||
var error42 = new Error("got illegal response body from proxy");
|
||||
error42.code = "ECONNRESET";
|
||||
@@ -446,13 +446,13 @@ var require_tunnel = __commonJS({
|
||||
self2.removeSocket(placeholder);
|
||||
return;
|
||||
}
|
||||
debug2("tunneling connection has established");
|
||||
debug("tunneling connection has established");
|
||||
self2.sockets[self2.sockets.indexOf(placeholder)] = socket;
|
||||
return cb(socket);
|
||||
}
|
||||
function onError(cause) {
|
||||
connectReq.removeAllListeners();
|
||||
debug2(
|
||||
debug(
|
||||
"tunneling socket could not be established, cause=%s\n",
|
||||
cause.message,
|
||||
cause.stack
|
||||
@@ -514,9 +514,9 @@ var require_tunnel = __commonJS({
|
||||
}
|
||||
return target;
|
||||
}
|
||||
var debug2;
|
||||
var debug;
|
||||
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
||||
debug2 = function() {
|
||||
debug = function() {
|
||||
var args3 = Array.prototype.slice.call(arguments);
|
||||
if (typeof args3[0] === "string") {
|
||||
args3[0] = "TUNNEL: " + args3[0];
|
||||
@@ -526,10 +526,10 @@ var require_tunnel = __commonJS({
|
||||
console.error.apply(console, args3);
|
||||
};
|
||||
} else {
|
||||
debug2 = function() {
|
||||
debug = function() {
|
||||
};
|
||||
}
|
||||
exports.debug = debug2;
|
||||
exports.debug = debug;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19740,10 +19740,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
return process.env["RUNNER_DEBUG"] === "1";
|
||||
}
|
||||
exports.isDebug = isDebug;
|
||||
function debug2(message) {
|
||||
function debug(message) {
|
||||
(0, command_1.issueCommand)("debug", {}, message);
|
||||
}
|
||||
exports.debug = debug2;
|
||||
exports.debug = debug;
|
||||
function error42(message, properties = {}) {
|
||||
(0, command_1.issueCommand)("error", (0, utils_1.toCommandProperties)(properties), message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
@@ -80422,7 +80422,7 @@ var log = {
|
||||
debug: (message) => {
|
||||
if (isDebugEnabled()) {
|
||||
if (isGitHubActions) {
|
||||
core.debug(message);
|
||||
core.info(`[DEBUG] ${message}`);
|
||||
} else {
|
||||
core.info(`[DEBUG] ${message}`);
|
||||
}
|
||||
@@ -91248,7 +91248,7 @@ function configureGeminiMcpServers({ mcpServers, cliPath }) {
|
||||
}
|
||||
|
||||
// agents/opencode.ts
|
||||
import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "node:fs";
|
||||
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
||||
import { join as join7 } from "node:path";
|
||||
var opencode = agent({
|
||||
name: "opencode",
|
||||
@@ -91272,10 +91272,6 @@ var opencode = agent({
|
||||
log.info("\u{1F512} sandbox mode enabled: restricting to read-only operations");
|
||||
}
|
||||
setupProcessAgentEnv({ HOME: tempHome });
|
||||
log.startGroup("\u{1F50D} DEBUG: Environment analysis");
|
||||
log.info(`Original process.env.HOME: ${process.env.HOME}`);
|
||||
log.info(`Original process.env.XDG_CONFIG_HOME: ${process.env.XDG_CONFIG_HOME || "(not set)"}`);
|
||||
log.info(`Target tempHome: ${tempHome}`);
|
||||
const env3 = {
|
||||
...Object.fromEntries(
|
||||
Object.entries(process.env).filter(
|
||||
@@ -91288,41 +91284,11 @@ var opencode = agent({
|
||||
for (const [key, value2] of Object.entries(apiKeys || {})) {
|
||||
env3[key.toUpperCase()] = value2;
|
||||
}
|
||||
log.info(`Final env.HOME: ${env3.HOME}`);
|
||||
log.info(`Final env.XDG_CONFIG_HOME: ${env3.XDG_CONFIG_HOME}`);
|
||||
const configPath = join7(env3.HOME, ".config", "opencode", "opencode.json");
|
||||
const configExists = existsSync3(configPath);
|
||||
log.info(`Config path: ${configPath}`);
|
||||
log.info(`Config file exists: ${configExists}`);
|
||||
if (configExists) {
|
||||
const configContents = readFileSync2(configPath, "utf-8");
|
||||
log.info(`Config file contents:
|
||||
${configContents}`);
|
||||
}
|
||||
const altConfigPaths = [
|
||||
join7(env3.HOME, ".opencode", "config.json"),
|
||||
join7(env3.HOME, ".opencode.json"),
|
||||
join7(process.cwd(), ".opencode.json"),
|
||||
join7(process.cwd(), ".opencode", "config.json")
|
||||
];
|
||||
for (const altPath of altConfigPaths) {
|
||||
if (existsSync3(altPath)) {
|
||||
log.info(`\u26A0\uFE0F Alternative config found at: ${altPath}`);
|
||||
}
|
||||
}
|
||||
const mcpUrl = "http://127.0.0.1:3764/mcp";
|
||||
try {
|
||||
const response = await fetch(mcpUrl, { method: "GET" });
|
||||
log.info(`MCP server reachable: ${response.ok} (status: ${response.status})`);
|
||||
} catch (error42) {
|
||||
log.warning(
|
||||
`MCP server NOT reachable: ${error42 instanceof Error ? error42.message : String(error42)}`
|
||||
);
|
||||
}
|
||||
log.endGroup();
|
||||
const repoDir = process.cwd();
|
||||
log.info(`\u{1F680} Starting OpenCode CLI: ${cliPath} ${args3.join(" ")}`);
|
||||
log.info(`\u{1F4C1} Working directory: ${repoDir}`);
|
||||
log.debug(`\u{1F3E0} HOME: ${env3.HOME}`);
|
||||
log.debug(`\u{1F4CB} XDG_CONFIG_HOME: ${env3.XDG_CONFIG_HOME}`);
|
||||
const startTime = Date.now();
|
||||
let lastActivityTime = startTime;
|
||||
let eventCount = 0;
|
||||
@@ -124082,35 +124048,33 @@ function GetCheckSuiteLogsTool(ctx) {
|
||||
|
||||
// mcp/debug.ts
|
||||
var DebugShellCommand = type({});
|
||||
var DebugShellCommandTool = tool({
|
||||
name: "debug_shell_command",
|
||||
description: "debug tool: runs 'git status' and returns the output. use this to test shell command execution in the MCP server.",
|
||||
parameters: DebugShellCommand,
|
||||
execute: async () => {
|
||||
try {
|
||||
function DebugShellCommandTool(_ctx) {
|
||||
return tool({
|
||||
name: "debug_shell_command",
|
||||
description: "debug tool: runs 'git status' and returns the output. use this to test shell command execution in the MCP server.",
|
||||
parameters: DebugShellCommand,
|
||||
execute: execute(_ctx, async () => {
|
||||
const result = $("git", ["status"]);
|
||||
return handleToolSuccess({
|
||||
return {
|
||||
success: true,
|
||||
command: "git status",
|
||||
output: result.trim()
|
||||
});
|
||||
} catch (error42) {
|
||||
return handleToolError(error42);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// mcp/files.ts
|
||||
import { relative, resolve } from "node:path";
|
||||
var ListFiles = type({
|
||||
path: type.string.describe("The path to list files from (defaults to current directory)").default(".")
|
||||
});
|
||||
var ListFilesTool = tool({
|
||||
name: "list_files",
|
||||
description: "List files in the repository, including both git-tracked and untracked files. Useful for discovering the file structure and locating files, including newly created files that haven't been committed yet.",
|
||||
parameters: ListFiles,
|
||||
execute: async ({ path: path4 }) => {
|
||||
try {
|
||||
function ListFilesTool(_ctx) {
|
||||
return tool({
|
||||
name: "list_files",
|
||||
description: "List files in the repository, including both git-tracked and untracked files. Useful for discovering the file structure and locating files, including newly created files that haven't been committed yet.",
|
||||
parameters: ListFiles,
|
||||
execute: execute(_ctx, async ({ path: path4 }) => {
|
||||
const pathStr = path4 ?? ".";
|
||||
const cwd2 = process.cwd();
|
||||
let gitFiles = [];
|
||||
@@ -124142,27 +124106,23 @@ var ListFilesTool = tool({
|
||||
findFailed = true;
|
||||
}
|
||||
if (gitFailed && findFailed) {
|
||||
return handleToolError(
|
||||
new Error(
|
||||
`Failed to list files: both git ls-files and find commands failed. Path: ${pathStr}, working directory: ${cwd2}`
|
||||
)
|
||||
throw new Error(
|
||||
`Failed to list files: both git ls-files and find commands failed. Path: ${pathStr}, working directory: ${cwd2}`
|
||||
);
|
||||
}
|
||||
const gitFilesSet = new Set(gitFiles);
|
||||
const allFiles = [.../* @__PURE__ */ new Set([...gitFiles, ...filesystemFiles])].sort();
|
||||
const untrackedFiles = filesystemFiles.filter((f) => !gitFilesSet.has(f));
|
||||
const untrackedCount = untrackedFiles.length;
|
||||
return handleToolSuccess({
|
||||
return {
|
||||
files: allFiles,
|
||||
method: "combined",
|
||||
trackedCount: gitFiles.length,
|
||||
untrackedCount
|
||||
});
|
||||
} catch (error42) {
|
||||
return handleToolError(error42);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// utils/secrets.ts
|
||||
function getAllSecrets() {
|
||||
@@ -125048,12 +125008,12 @@ async function startMcpHttpServer(ctx) {
|
||||
GetReviewCommentsTool(ctx),
|
||||
ListPullRequestReviewsTool(ctx),
|
||||
GetCheckSuiteLogsTool(ctx),
|
||||
DebugShellCommandTool,
|
||||
DebugShellCommandTool(ctx),
|
||||
AddLabelsTool(ctx),
|
||||
CreateBranchTool(ctx),
|
||||
CommitFilesTool(ctx),
|
||||
PushBranchTool(ctx),
|
||||
ListFilesTool
|
||||
ListFilesTool(ctx)
|
||||
];
|
||||
if (!isProgressCommentDisabled(ctx)) {
|
||||
tools.push(ReportProgressTool(ctx));
|
||||
@@ -125080,7 +125040,7 @@ async function startMcpHttpServer(ctx) {
|
||||
}
|
||||
|
||||
// prep/installNodeDependencies.ts
|
||||
import { existsSync as existsSync4 } from "node:fs";
|
||||
import { existsSync as existsSync3 } from "node:fs";
|
||||
import { join as join9 } from "node:path";
|
||||
|
||||
// ../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/commands.mjs
|
||||
@@ -125414,7 +125374,7 @@ var installNodeDependencies = {
|
||||
name: "installNodeDependencies",
|
||||
shouldRun: () => {
|
||||
const packageJsonPath = join9(process.cwd(), "package.json");
|
||||
return existsSync4(packageJsonPath);
|
||||
return existsSync3(packageJsonPath);
|
||||
},
|
||||
run: async () => {
|
||||
const detected = await detect({ cwd: process.cwd() });
|
||||
@@ -125474,7 +125434,7 @@ var installNodeDependencies = {
|
||||
};
|
||||
|
||||
// prep/installPythonDependencies.ts
|
||||
import { existsSync as existsSync5 } from "node:fs";
|
||||
import { existsSync as existsSync4 } from "node:fs";
|
||||
import { join as join10 } from "node:path";
|
||||
var PYTHON_CONFIGS = [
|
||||
{
|
||||
@@ -125547,11 +125507,11 @@ var installPythonDependencies = {
|
||||
return false;
|
||||
}
|
||||
const cwd2 = process.cwd();
|
||||
return PYTHON_CONFIGS.some((config3) => existsSync5(join10(cwd2, config3.file)));
|
||||
return PYTHON_CONFIGS.some((config3) => existsSync4(join10(cwd2, config3.file)));
|
||||
},
|
||||
run: async () => {
|
||||
const cwd2 = process.cwd();
|
||||
const config3 = PYTHON_CONFIGS.find((c) => existsSync5(join10(cwd2, c.file)));
|
||||
const config3 = PYTHON_CONFIGS.find((c) => existsSync4(join10(cwd2, c.file)));
|
||||
if (!config3) {
|
||||
return {
|
||||
language: "python",
|
||||
|
||||
Reference in New Issue
Block a user