afterbefore 0.1.15 → 0.1.17

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 CHANGED
@@ -16,6 +16,7 @@ var Logger = class {
16
16
  lastLabel = "";
17
17
  pipelineActive = false;
18
18
  logBuffer = [];
19
+ isTTY = !!process.stderr.isTTY;
19
20
  log(level, message) {
20
21
  const ts = (/* @__PURE__ */ new Date()).toISOString();
21
22
  this.logBuffer.push(`${ts} [${level}] ${message}`);
@@ -90,10 +91,14 @@ var Logger = class {
90
91
  this.clearSpinner();
91
92
  this.log("info", `Pipeline started (${total} steps)`);
92
93
  const text = this.renderPipeline(0, "Starting...");
93
- this.spinner = ora({
94
- text: chalk.dim(text),
95
- spinner: BAR_SPINNER
96
- }).start();
94
+ if (this.isTTY) {
95
+ this.spinner = ora({
96
+ text: chalk.dim(text),
97
+ spinner: BAR_SPINNER
98
+ }).start();
99
+ } else {
100
+ console.error(chalk.dim(text));
101
+ }
97
102
  }
98
103
  pipeline(step, label) {
99
104
  if (step === this.lastStep && label === this.lastLabel) return;
@@ -101,6 +106,9 @@ var Logger = class {
101
106
  this.lastLabel = label;
102
107
  this.log("step", `${step}/${this.pipelineTotal} ${label}`);
103
108
  const text = chalk.dim(this.renderPipeline(step, label));
109
+ if (!this.isTTY) {
110
+ return;
111
+ }
104
112
  if (!this.spinner) {
105
113
  this.spinner = ora({
106
114
  text,
@@ -1941,7 +1949,7 @@ async function runPipeline(options) {
1941
1949
  const outputDir = resolve4(cwd, output, sessionName);
1942
1950
  const startTime = Date.now();
1943
1951
  try {
1944
- const version = true ? "0.1.15" : "dev";
1952
+ const version = true ? "0.1.17" : "dev";
1945
1953
  console.log(`
1946
1954
  afterbefore v${version} \xB7 Comparing against ${base}
1947
1955
  `);
@@ -2086,7 +2094,7 @@ afterbefore v${version} \xB7 Comparing against ${base}
2086
2094
  var program = new Command();
2087
2095
  program.name("afterbefore").description(
2088
2096
  "Automatic before/after screenshot capture for PRs. Git diff is the config."
2089
- ).version("0.1.15").option("--base <ref>", "Base branch or ref to compare against", "main").option("--output <dir>", "Output directory for screenshots", ".afterbefore").option("--post", "Post results as a PR comment via gh CLI", false).option(
2097
+ ).version("0.1.17").option("--base <ref>", "Base branch or ref to compare against", "main").option("--output <dir>", "Output directory for screenshots", ".afterbefore").option("--post", "Post results as a PR comment via gh CLI", false).option(
2090
2098
  "--threshold <percent>",
2091
2099
  "Diff threshold percentage (changes below this are ignored)",
2092
2100
  "0.1"