@kaynooo/cli-forgejo 0.26.0 → 0.27.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.
Files changed (2) hide show
  1. package/dist/cli.js +15 -5
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -2864,8 +2864,8 @@ function elapsed(run, seen) {
2864
2864
  const seconds = Math.floor((Date.now() - (startedAt(run) ?? seen)) / 1000);
2865
2865
  return seconds > 0 ? `for ${formatSeconds(seconds)}` : undefined;
2866
2866
  }
2867
- function runLine(run, out, seen = Date.now()) {
2868
- return ciLine(run.status, run.workflow_id, [`run ${run.id}`, `on ${run.prettyref}`, elapsed(run, seen)], out);
2867
+ function runLine(run, out, seen = Date.now(), ref = run.prettyref) {
2868
+ return ciLine(run.status, run.workflow_id, [`run ${hyperlink(String(run.id), run.html_url, out)}`, `on ${ref}`, elapsed(run, seen)], out);
2869
2869
  }
2870
2870
  function startedAge(run, now = Date.now()) {
2871
2871
  return startedAt(run) === undefined ? "-" : formatAge(run.started, now);
@@ -2965,8 +2965,9 @@ async function failedJobsOf(run, repo) {
2965
2965
  }
2966
2966
  return failed;
2967
2967
  }
2968
- function failureText(failed) {
2969
- return failed.map((job) => `job ${job.name} of ${job.workflow} failed:
2968
+ function failureText(failed, out = process.stderr) {
2969
+ const problem = role("failed", out);
2970
+ return failed.map((job) => `${problem(`job ${job.name} of ${job.workflow} failed`)}:
2970
2971
  ${job.excerpt}`).join(`
2971
2972
 
2972
2973
  `);
@@ -3051,6 +3052,7 @@ async function ci2(args) {
3051
3052
  return;
3052
3053
  }
3053
3054
  const json = values.json === true;
3055
+ const live = takesControlCodes(process23.stderr) && takesControlCodes(process23.stdout) && !json && values.quiet !== true;
3054
3056
  const runs = await waitForCi({
3055
3057
  tool: "ft ci",
3056
3058
  short,
@@ -3063,6 +3065,8 @@ async function ci2(args) {
3063
3065
  finished: (found) => found.every((run) => FINISHED.has(run.status)),
3064
3066
  key: (found) => found.map((run) => run.id).join(","),
3065
3067
  announce: (found) => {
3068
+ if (live)
3069
+ return;
3066
3070
  const say = json ? console.error : console.log;
3067
3071
  for (const run of found)
3068
3072
  say(`following ${run.workflow_id} run ${run.id} on ${run.commit_sha.slice(0, 7)}${run.commit_sha === sha ? "" : `, which covers ${short}`}: ${run.html_url}`);
@@ -3075,7 +3079,7 @@ async function ci2(args) {
3075
3079
  },
3076
3080
  lines: (spinner, found, started) => [
3077
3081
  ciHeader(spinner, `CI on ${short}`, started, process23.stderr),
3078
- ...(found ?? []).map((run) => ` ${runLine(run, process23.stderr)}`)
3082
+ ...(found ?? []).map((run) => ` ${runLine(run, process23.stderr, undefined, run.commit_sha.slice(0, 7))}`)
3079
3083
  ]
3080
3084
  });
3081
3085
  const status = overall(runs);
@@ -3090,7 +3094,13 @@ async function ci2(args) {
3090
3094
  printJson(ciJson(runs, failed));
3091
3095
  return status === "failure" ? 1 : 0;
3092
3096
  }
3097
+ if (live) {
3098
+ for (const run of runs)
3099
+ console.log(runLine(run, process23.stdout, undefined, run.commit_sha.slice(0, 7)));
3100
+ }
3093
3101
  if (status !== "failure") {
3102
+ if (live)
3103
+ return 0;
3094
3104
  console.log(good(`CI ${status === "success" ? "passed" : "skipped its tests, a release tag's workflow testing them"} on ${short}`));
3095
3105
  return 0;
3096
3106
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-forgejo",
3
3
  "type": "module",
4
- "version": "0.26.0",
4
+ "version": "0.27.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.33.0"
31
+ "@kaynooo/cli-kit": "0.34.0"
32
32
  }
33
33
  }