Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/src/pages/cli.astro
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@ dex complete abc123 --result "Planning complete, no code changes" --no-commit`}
<li><code>-d, --description</code> — Updated description</li>
<li><code>--add-blocker &lt;id&gt;</code> — Add blocking dependency</li>
<li><code>--remove-blocker &lt;id&gt;</code> — Remove blocking dependency</li>
<li><code>--unstart</code> — Clear started status (move back to ready)</li>
</ul>
<Terminal title="Terminal">
<Code
code={`dex edit abc123 -n "Updated name"
dex edit abc123 --add-blocker xyz789
dex edit abc123 --remove-blocker xyz789`}
dex edit abc123 --remove-blocker xyz789
dex edit abc123 --unstart`}
lang="bash"
theme="vitesse-black"
/>
Expand Down
35 changes: 35 additions & 0 deletions src/cli/edit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,4 +370,39 @@ describe("edit command", () => {
const out = output.stdout.join("\n");
expect(out).toContain("--commit");
});

it("moves an in-progress task back to ready with --unstart", async () => {
await runCli(["create", "-n", "In progress task", "--description", "ctx"], {
storage,
});
const taskId = output.stdout.join("\n").match(TASK_ID_REGEX)?.[1];
output.stdout.length = 0;

// Start the task
await runCli(["start", taskId!], { storage });
output.stdout.length = 0;

// Verify it's in progress
const storeBeforeUnstart = await storage.readAsync();
const taskBefore = storeBeforeUnstart.tasks.find((t) => t.id === taskId);
expect(taskBefore?.started_at).toBeTruthy();

// Unstart the task
await runCli(["edit", taskId!, "--unstart"], { storage });

const out = output.stdout.join("\n");
expect(out).toContain("Updated");

// Verify started_at is cleared
const storeAfter = await storage.readAsync();
const taskAfter = storeAfter.tasks.find((t) => t.id === taskId);
expect(taskAfter?.started_at).toBeNull();
});

it("shows --unstart in help", async () => {
await runCli(["edit", "-h"], { storage });

const out = output.stdout.join("\n");
expect(out).toContain("--unstart");
});
});
6 changes: 6 additions & 0 deletions src/cli/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function editCommand(
"add-blocker": { hasValue: true },
"remove-blocker": { hasValue: true },
commit: { short: "c", hasValue: true },
unstart: { hasValue: false },
help: { short: "h", hasValue: false },
},
"edit",
Expand All @@ -46,6 +47,7 @@ ${colors.bold}OPTIONS:${colors.reset}
--add-blocker <ids> Comma-separated task IDs to add as blockers
--remove-blocker <ids> Comma-separated task IDs to remove as blockers
-c, --commit <sha> Link a git commit to the task
--unstart Clear started status (move back to ready)
-h, --help Show this help message

${colors.bold}EXAMPLE:${colors.reset}
Expand All @@ -55,6 +57,7 @@ ${colors.bold}EXAMPLE:${colors.reset}
dex edit abc123 --add-blocker def456
dex edit abc123 --remove-blocker def456
dex edit abc123 --commit a1b2c3d
dex edit abc123 --unstart
`);
return;
}
Expand Down Expand Up @@ -118,6 +121,8 @@ ${colors.bold}EXAMPLE:${colors.reset}
};
}

const unstart = getBooleanFlag(flags, "unstart");

const task = await service.update({
id,
name: getStringFlag(flags, "name"),
Expand All @@ -127,6 +132,7 @@ ${colors.bold}EXAMPLE:${colors.reset}
add_blocked_by: addBlockedBy,
remove_blocked_by: removeBlockedBy,
metadata,
...(unstart ? { started_at: null } : {}),
});

console.log(
Expand Down
1 change: 1 addition & 0 deletions src/cli/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ${colors.bold}COMMANDS:${colors.reset}
show <id> --json Output as JSON (for scripts)
edit <id> [-n "..."] Edit task
edit <id> --commit <sha> Link commit to completed task
edit <id> --unstart Move task from in progress back to ready
update Alias for edit command
start <id> Mark task as in progress
start <id> --force Re-claim task already in progress
Expand Down