Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import { out } from "../shared/adapters/io.ts";
import type { Args } from "../shared/cli.ts";
import { ExpectedError } from "../shared/errors.ts";
import { milestoneIssues } from "./adapters/gh.ts";
import { commitLog } from "./adapters/git.ts";
import { oneProject, projectMap, readProject } from "./adapters/files.ts";
import { fileableNow } from "./domain/filing.ts";
import { describeQueue } from "./domain/queue.ts";
import { activityByIssue, syncTargetOf, toSnapshot } from "./domain/snapshot.ts";
/** What can be taken or filed now, read live from GitHub rather than from the last snapshot. */
export const next = ({ positionals }: Args): void => {
const id = oneProject(positionals);
const read = syncTargetOf(readProject(id));
if ("problem" in read) throw new ExpectedError(`${id}.yaml can't be read: ${read.problem}.`);
const { issues } = toSnapshot(
read.milestone,
milestoneIssues(read.milestone),
[],
activityByIssue(commitLog()),
"",
);
const fileable = fileableNow(projectMap(id), issues).map((ids) => ` ${ids.join(" + ")}`);
const lines = [
...(fileable.length > 0
? [`Can file now (${fileable.length}) · pnpm workflow:file ${id} --yes`, ...fileable]
: []),
...describeQueue(issues),
];
if (lines.length === 0) {
out.success(`${id}: nothing open in ${read.milestone}.`);
return;
}
out.note(lines.join("\n"), `${id} · ${read.milestone}`);
};
|