chore(runner): add diagnostic console logs inside task parser

This commit is contained in:
2026-06-03 15:08:54 -07:00
parent 3c0d3d5175
commit a42eaa4e40
2 changed files with 19 additions and 2 deletions

View File

@@ -240,6 +240,7 @@ function parseTaskItems(repoRoot) {
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const path = require("path");
const tasksDir = findTasksDir(repoRoot); const tasksDir = findTasksDir(repoRoot);
console.log(`[Orchestrator] repoRoot: "${repoRoot}", resolved tasksDir: "${tasksDir}"`);
if (!tasksDir) if (!tasksDir)
return []; return [];
const items = []; const items = [];
@@ -247,19 +248,23 @@ function parseTaskItems(repoRoot) {
const files = fs const files = fs
.readdirSync(tasksDir) .readdirSync(tasksDir)
.filter((f) => f.endsWith(".md")); .filter((f) => f.endsWith(".md"));
console.log(`[Orchestrator] Found task files:`, files);
files.sort(); files.sort();
for (const file of files) { for (const file of files) {
const filePath = path.join(tasksDir, file); const filePath = path.join(tasksDir, file);
const content = fs.readFileSync(filePath, "utf8"); const content = fs.readFileSync(filePath, "utf8");
console.log(`[Orchestrator] Reading ${file} (length: ${content.length} bytes). Head:\n${content.slice(0, 500)}`);
const lines = content.split("\n"); const lines = content.split("\n");
lines.forEach((line, lineIndex) => { lines.forEach((line, lineIndex) => {
const match = line.match(/^(\s*)(?:-\s*)?\[([ xX])\]\s+(.+)$/); const match = line.match(/^(\s*)(?:-\s*)?\[([ xX])\]\s+(.+)$/);
if (match && match[2] !== undefined && match[3] !== undefined) { if (match && match[2] !== undefined && match[3] !== undefined) {
const checked = match[2].toLowerCase() === "x";
console.log(`[Orchestrator] Parsed line ${lineIndex + 1}: isChecked=${checked}, text="${match[3].trim()}"`);
items.push({ items.push({
text: match[3].trim(), text: match[3].trim(),
filePath, filePath,
lineIndex, lineIndex,
isChecked: match[2].toLowerCase() === "x", isChecked: checked,
fileName: file, fileName: file,
}); });
} }

View File

@@ -333,6 +333,9 @@ function parseTaskItems(repoRoot: string): TaskItem[] {
const fs = require("fs") as typeof import("fs"); const fs = require("fs") as typeof import("fs");
const path = require("path") as typeof import("path"); const path = require("path") as typeof import("path");
const tasksDir = findTasksDir(repoRoot); const tasksDir = findTasksDir(repoRoot);
console.log(
`[Orchestrator] repoRoot: "${repoRoot}", resolved tasksDir: "${tasksDir}"`,
);
if (!tasksDir) return []; if (!tasksDir) return [];
const items: TaskItem[] = []; const items: TaskItem[] = [];
@@ -340,20 +343,29 @@ function parseTaskItems(repoRoot: string): TaskItem[] {
const files = fs const files = fs
.readdirSync(tasksDir) .readdirSync(tasksDir)
.filter((f: string) => f.endsWith(".md")); .filter((f: string) => f.endsWith(".md"));
console.log(`[Orchestrator] Found task files:`, files);
files.sort(); files.sort();
for (const file of files) { for (const file of files) {
const filePath = path.join(tasksDir, file); const filePath = path.join(tasksDir, file);
const content = fs.readFileSync(filePath, "utf8"); const content = fs.readFileSync(filePath, "utf8");
console.log(
`[Orchestrator] Reading ${file} (length: ${content.length} bytes). Head:\n${content.slice(0, 500)}`,
);
const lines = content.split("\n"); const lines = content.split("\n");
lines.forEach((line: string, lineIndex: number) => { lines.forEach((line: string, lineIndex: number) => {
const match = line.match(/^(\s*)(?:-\s*)?\[([ xX])\]\s+(.+)$/); const match = line.match(/^(\s*)(?:-\s*)?\[([ xX])\]\s+(.+)$/);
if (match && match[2] !== undefined && match[3] !== undefined) { if (match && match[2] !== undefined && match[3] !== undefined) {
const checked = match[2].toLowerCase() === "x";
console.log(
`[Orchestrator] Parsed line ${lineIndex + 1}: isChecked=${checked}, text="${match[3].trim()}"`,
);
items.push({ items.push({
text: match[3].trim(), text: match[3].trim(),
filePath, filePath,
lineIndex, lineIndex,
isChecked: match[2].toLowerCase() === "x", isChecked: checked,
fileName: file, fileName: file,
}); });
} }