mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-05-25 01:54:14 +02:00
bb89d6f458
- Add ActivityLogger interface wrapping Temporal's Context.current().log - Thread logger parameter through claude-executor, message-handlers, git-manager, prompt-manager, reporting, and agent validators - Remove chalk dependency from all service/activity files; CLI files keep console.log for terminal output - Replace colorFn: ChalkInstance parameter with structured logger.info/warn/error calls - Use replay-safe `log` import from @temporalio/workflow in workflows.ts
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
// Copyright (C) 2025 Keygraph, Inc.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License version 3
|
|
// as published by the Free Software Foundation.
|
|
|
|
export class ProgressIndicator {
|
|
private message: string;
|
|
private frames: string[] = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
private frameIndex: number = 0;
|
|
private interval: ReturnType<typeof setInterval> | null = null;
|
|
private isRunning: boolean = false;
|
|
|
|
constructor(message: string = 'Working...') {
|
|
this.message = message;
|
|
}
|
|
|
|
start(): void {
|
|
if (this.isRunning) return;
|
|
|
|
this.isRunning = true;
|
|
this.frameIndex = 0;
|
|
|
|
this.interval = setInterval(() => {
|
|
// Clear the line and write the spinner
|
|
process.stdout.write(`\r${this.frames[this.frameIndex]} ${this.message}`);
|
|
this.frameIndex = (this.frameIndex + 1) % this.frames.length;
|
|
}, 100);
|
|
}
|
|
|
|
stop(): void {
|
|
if (!this.isRunning) return;
|
|
|
|
if (this.interval) {
|
|
clearInterval(this.interval);
|
|
this.interval = null;
|
|
}
|
|
|
|
// Clear the spinner line
|
|
process.stdout.write('\r' + ' '.repeat(this.message.length + 5) + '\r');
|
|
this.isRunning = false;
|
|
}
|
|
|
|
finish(successMessage: string = 'Complete'): void {
|
|
this.stop();
|
|
console.log(`✓ ${successMessage}`);
|
|
}
|
|
}
|