Skip to content

Commit 9d0095a

Browse files
committed
feat: log CLI invocation details in generateAgentRules
Log the patchloom binary path, arguments, and working directory before exec, and log stdout/stderr/exit code after completion. This makes CLI interactions visible in the Patchloom output channel for debugging. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 8a56c20 commit 9d0095a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/commands/initializeProject.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { execFile } from "node:child_process";
22
import { promisify } from "node:util";
33
import type * as VSCode from "vscode";
44
import { patchloomNeedsUpgrade, resolvePatchloomStatus } from "../binary/patchloom.js";
5+
import { getPatchloomLog } from "../logging/outputChannel.js";
56
import { formatError } from "../util.js";
67
import { activeWorkspaceFolder } from "../workspace/readiness.js";
78

@@ -102,12 +103,16 @@ export function classifyAgentsFile(existingContent: string | undefined, generate
102103
}
103104

104105
async function generateAgentRules(binaryPath: string, cwd: string): Promise<string> {
105-
const { stdout } = await execFileAsync(binaryPath, ["agent-rules"], {
106+
const log = getPatchloomLog();
107+
const args = ["agent-rules"];
108+
log?.logCommand(binaryPath, args, cwd);
109+
const { stdout, stderr } = await execFileAsync(binaryPath, args, {
106110
cwd,
107111
timeout: 10_000,
108112
maxBuffer: 1024 * 1024,
109113
windowsHide: true
110114
});
115+
log?.logResult(0, stdout, stderr);
111116
return stdout.endsWith("\n") ? stdout : `${stdout}\n`;
112117
}
113118

0 commit comments

Comments
 (0)