refactor: js output

This commit is contained in:
Tiara Rodney 2026-03-15 05:11:59 +01:00
parent 1aa28c2a34
commit c6704c3a04
No known key found for this signature in database
GPG key ID: 5CD8EC1D46106723
96 changed files with 3816 additions and 147 deletions

View file

@ -0,0 +1,29 @@
import { CLICommand } from "../cli/CLICommand.js";
import { parseTodoFile } from "../file.js";
export class IssuesInSprintCommand extends CLICommand {
name = "issues-in-sprint <name>";
help = "List issues in a sprint";
description = "Find issues whose date range overlaps with a sprint";
addArguments(yargs) {
return yargs.positional("name", { type: "string", demandOption: true });
}
async execute(args) {
const todo = await parseTodoFile();
const sprint = todo.sprints.find(s => s.name === args.name);
if (!sprint) {
console.error(`Sprint not found: ${args.name}`);
return 1;
}
const { start, end } = sprint;
for (const issue of todo.issues) {
const ds = issue.dueStart ?? issue.dueEnd;
const de = issue.dueEnd ?? issue.dueStart;
if (!ds || !de)
continue;
if (ds <= end && de >= start) {
console.log(`#${issue.id} [${issue.type}] (${issue.status}) ${issue.title}`);
}
}
return 0;
}
}