diff --git a/vibn-agent-runner/dist/agent-session-runner.js b/vibn-agent-runner/dist/agent-session-runner.js index c38a46d..182fd2e 100644 --- a/vibn-agent-runner/dist/agent-session-runner.js +++ b/vibn-agent-runner/dist/agent-session-runner.js @@ -224,7 +224,7 @@ function parseTaskItems(repoRoot) { const content = fs.readFileSync(filePath, "utf8"); const lines = content.split("\n"); 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) { items.push({ text: match[3].trim(), @@ -248,9 +248,12 @@ function toggleTaskOnDisk(task) { const lines = content.split("\n"); const line = lines[task.lineIndex]; if (line) { - const match = line.match(/^(\s*)-\s*\[([ xX])\]\s+(.+)$/); + const match = line.match(/^(\s*)(?:-\s*)?\[([ xX])\]\s+(.+)$/); if (match && match[1] !== undefined && match[3] !== undefined) { - lines[task.lineIndex] = `${match[1]}- [x] ${match[3]}`; + const indent = match[1] || ""; + const hasDash = line.includes("-"); + const prefix = hasDash ? `${indent}- ` : indent; + lines[task.lineIndex] = `${prefix}[x] ${match[3]}`; fs.writeFileSync(task.filePath, lines.join("\n"), "utf8"); } } diff --git a/vibn-agent-runner/src/agent-session-runner.ts b/vibn-agent-runner/src/agent-session-runner.ts index f28d5a0..6b51a0f 100644 --- a/vibn-agent-runner/src/agent-session-runner.ts +++ b/vibn-agent-runner/src/agent-session-runner.ts @@ -316,7 +316,7 @@ function parseTaskItems(repoRoot: string): TaskItem[] { const content = fs.readFileSync(filePath, "utf8"); const lines = content.split("\n"); 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) { items.push({ text: match[3].trim(), @@ -340,9 +340,12 @@ function toggleTaskOnDisk(task: TaskItem): void { const lines = content.split("\n"); const line = lines[task.lineIndex]; if (line) { - const match = line.match(/^(\s*)-\s*\[([ xX])\]\s+(.+)$/); + const match = line.match(/^(\s*)(?:-\s*)?\[([ xX])\]\s+(.+)$/); if (match && match[1] !== undefined && match[3] !== undefined) { - lines[task.lineIndex] = `${match[1]}- [x] ${match[3]}`; + const indent = match[1] || ""; + const hasDash = line.includes("-"); + const prefix = hasDash ? `${indent}- ` : indent; + lines[task.lineIndex] = `${prefix}[x] ${match[3]}`; fs.writeFileSync(task.filePath, lines.join("\n"), "utf8"); } }