@kaynooo/cli-forgejo 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +16 -14
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -569,14 +569,15 @@ function printHeader(bin, context, stream = process6.stdout, env = process6.env)
|
|
|
569
569
|
if (line !== "")
|
|
570
570
|
console.log(line);
|
|
571
571
|
}
|
|
572
|
-
function section(title, count, stream = process6.stdout, env = process6.env) {
|
|
572
|
+
function section(title, count, stream = process6.stdout, env = process6.env, tone) {
|
|
573
573
|
const label = count === undefined ? title : `${title} (${count})`;
|
|
574
574
|
if (!takesControlCodes(stream, env))
|
|
575
575
|
return label;
|
|
576
576
|
const { glyphs } = activeTheme().theme;
|
|
577
577
|
const head = `${glyphs.corner}${glyphs.rule} ${label} `;
|
|
578
578
|
const width = Math.min(stream.columns ?? 60, 100);
|
|
579
|
-
|
|
579
|
+
const rule = head + glyphs.rule.repeat(Math.max(3, width - Bun.stringWidth(head)));
|
|
580
|
+
return tone === undefined ? paint(stream, env).dim(rule) : tinted(paint(stream, env), activeTheme().theme.colors[tone], env)(rule);
|
|
580
581
|
}
|
|
581
582
|
function hyperlink(text, url, stream, env = process6.env) {
|
|
582
583
|
return takesControlCodes(stream, env) ? link(text, url, stream, env) : text;
|
|
@@ -2478,11 +2479,11 @@ function renderBoard(rows, now = Date.now(), limit = Number.POSITIVE_INFINITY) {
|
|
|
2478
2479
|
const taken = claimed("taken");
|
|
2479
2480
|
const away = claimed("away");
|
|
2480
2481
|
const sections = [
|
|
2481
|
-
{ heading: "available", count: available.length, ...within(available, limit, ({ issue }) => [issueNumber2(issue), truncate(issue.title, TITLE_WIDTH), dimmed(issue.labels.map((label) => label.name).join(", "))]) },
|
|
2482
|
-
{ heading: "taken", count: taken.length, ...within(taken, limit, ({ issue, row }) => claimRow(issue, row, now)) },
|
|
2483
|
-
{ heading: "claimed, no live session here", count: away.length, ...within(away, limit, ({ issue, row }) => claimRow(issue, row, now), (line, index) => [line, ...noteLine(away[index]?.comments ?? [], now)]) }
|
|
2482
|
+
{ heading: "available", tone: "ok", count: available.length, ...within(available, limit, ({ issue }) => [issueNumber2(issue), truncate(issue.title, TITLE_WIDTH), dimmed(issue.labels.map((label) => label.name).join(", "))]) },
|
|
2483
|
+
{ heading: "taken", tone: "running", count: taken.length, ...within(taken, limit, ({ issue, row }) => claimRow(issue, row, now)) },
|
|
2484
|
+
{ heading: "claimed, no live session here", tone: "warn", count: away.length, ...within(away, limit, ({ issue, row }) => claimRow(issue, row, now), (line, index) => [line, ...noteLine(away[index]?.comments ?? [], now)]) }
|
|
2484
2485
|
].filter((section) => section.count > 0);
|
|
2485
|
-
return sections.length === 0 ? "no open issue" : sections.map(({ heading, count, lines }) => `${
|
|
2486
|
+
return sections.length === 0 ? "no open issue" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process.stdout, process.env, tone)}
|
|
2486
2487
|
${lines.join(`
|
|
2487
2488
|
`).replace(LINE_START, " ")}`).join(`
|
|
2488
2489
|
|
|
@@ -3093,24 +3094,25 @@ async function staleTodos() {
|
|
|
3093
3094
|
return [...byIssue.values()];
|
|
3094
3095
|
}
|
|
3095
3096
|
function claimLine(row, now) {
|
|
3096
|
-
|
|
3097
|
+
const id = role("id", process22.stdout);
|
|
3098
|
+
return [id(`#${row.number}`), row.holder, paint(process22.stdout).dim(formatAge(row.since, now)), row.boxesTotal === 0 ? "" : `${row.boxesLeft}/${row.boxesTotal} left`, truncate(row.title, TITLE_WIDTH2)];
|
|
3097
3099
|
}
|
|
3098
3100
|
function capped2(lines) {
|
|
3099
3101
|
return lines.length > SHOWN ? [...lines.slice(0, SHOWN), `... ${lines.length - SHOWN} more`] : lines;
|
|
3100
3102
|
}
|
|
3101
3103
|
function renderDigest(digest, now = Date.now()) {
|
|
3102
3104
|
const sections = [
|
|
3103
|
-
{ heading: "held by this session", count: digest.held.length, lines: table(digest.held.map((row) => claimLine(row, now))).split(`
|
|
3105
|
+
{ heading: "held by this session", tone: "running", count: digest.held.length, lines: table(digest.held.map((row) => claimLine(row, now))).split(`
|
|
3104
3106
|
`) },
|
|
3105
|
-
{ heading: "claimed, no live session here", count: digest.away.length, lines: table(digest.away.map((row) => claimLine(row, now))).split(`
|
|
3107
|
+
{ heading: "claimed, no live session here", tone: "warn", count: digest.away.length, lines: table(digest.away.map((row) => claimLine(row, now))).split(`
|
|
3106
3108
|
`) },
|
|
3107
|
-
{ heading: "CI on the default branch", count: digest.ci.length, lines: digest.ci.map((run) => `${run.workflow} ${run.status} (run ${run.id}) ${truncate(upTo(run.title, `
|
|
3109
|
+
{ heading: "CI on the default branch", tone: "failed", count: digest.ci.length, lines: digest.ci.map((run) => `${run.workflow} ${badge(run.status, process22.stdout)} (run ${run.id}) ${truncate(upTo(run.title, `
|
|
3108
3110
|
`), TITLE_WIDTH2)}`) },
|
|
3109
|
-
{ heading: "unpushed commits", count: digest.unpushed.length, lines: capped2(digest.unpushed) },
|
|
3110
|
-
{ heading: "dirty files", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${file.path}`)) },
|
|
3111
|
-
{ heading: "stale TODO comments", count: digest.stale.length, lines: capped2(digest.stale.map((todo) => `${todo.issue} closed: ${todo.comments.map((each) => `${each.path}:${each.line}`).join(", ")}`)) }
|
|
3111
|
+
{ heading: "unpushed commits", tone: "queued", count: digest.unpushed.length, lines: capped2(digest.unpushed) },
|
|
3112
|
+
{ heading: "dirty files", tone: "warn", count: digest.dirty.length, lines: capped2(digest.dirty.map((file) => `${file.status} ${role("path", process22.stdout)(file.path)}`)) },
|
|
3113
|
+
{ heading: "stale TODO comments", tone: "skipped", count: digest.stale.length, lines: capped2(digest.stale.map((todo) => `${todo.issue} closed: ${todo.comments.map((each) => `${each.path}:${each.line}`).join(", ")}`)) }
|
|
3112
3114
|
].filter((each) => each.count > 0);
|
|
3113
|
-
return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, count, lines }) => `${section(heading, count)}
|
|
3115
|
+
return sections.length === 0 ? "nothing to pick up" : sections.map(({ heading, tone, count, lines }) => `${section(heading, count, process22.stdout, process22.env, tone)}
|
|
3114
3116
|
${lines.join(`
|
|
3115
3117
|
`).replace(LINE_START2, " ")}`).join(`
|
|
3116
3118
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-forgejo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"description": "ft: Forgejo CI runs, logs, releases and issue checklists from the terminal, through tea.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"ft": "$npm_execpath src/cli.ts"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@kaynooo/cli-kit": "0.
|
|
31
|
+
"@kaynooo/cli-kit": "0.28.0"
|
|
32
32
|
}
|
|
33
33
|
}
|