Add web front-end and fix API issues
CI/CD Pipeline / test (push) Failing after 2m38s
CI/CD Pipeline / deploy-internal (push) Has been skipped

This commit is contained in:
chris committed 2026-08-28 21:47:05 -04:00
1 parent 45ca4de0ad
commit a7524412f0
2571 files changed
+86998 -5

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { COLOR_MARKER_RE } from '../logger.js';
function visibleLength(value) {
return value ? value.replace(COLOR_MARKER_RE, '').length : 0;
}
export class LoggerPadding {
logger;
constructor({ logger }) {
this.logger = logger;
}
handle(commands) {
// Sometimes there's limited concurrency, so not all commands will spawn straight away.
// Compute the prefix length now, which works for all styles but those with a PID.
let length = commands.reduce((length, command) => {
const content = this.logger.getPrefixContent(command);
return Math.max(length, visibleLength(content?.value));
}, 0);
this.logger.setPrefixLength(length);
// The length of prefixes is somewhat stable, except for PIDs, which might change when a
// process spawns (e.g. PIDs might look like 1, 10 or 100), therefore listen to command starts
// and update the prefix length when this happens.
const subs = commands.map((command) => command.timer.subscribe((event) => {
if (!event.endDate) {
const content = this.logger.getPrefixContent(command);
length = Math.max(length, visibleLength(content?.value));
this.logger.setPrefixLength(length);
}
}));
return {
commands,
onFinish() {
subs.forEach((sub) => sub.unsubscribe());
},
};
}
}