@qianxude/tem 0.4.5 → 0.4.7
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/package.json +1 -1
- package/src/cli/README.md +4 -4
- package/src/cli/commands/watch.ts +16 -7
- package/src/cli/index.ts +1 -1
- package/src/index.ts +2 -0
package/package.json
CHANGED
package/src/cli/README.md
CHANGED
|
@@ -138,12 +138,12 @@ tem watch <db-path> [batch-code]
|
|
|
138
138
|
- `--latest` - Watch the most recently created batch
|
|
139
139
|
- `--interval N` - Refresh interval in seconds (default: 5)
|
|
140
140
|
- `--timeout N` - Maximum watch time in seconds (default: 3600)
|
|
141
|
-
- `--
|
|
141
|
+
- `--append` - Append reports instead of clearing screen (creates scrollable history)
|
|
142
142
|
|
|
143
143
|
**Examples:**
|
|
144
144
|
|
|
145
145
|
```sh
|
|
146
|
-
# Watch the latest batch
|
|
146
|
+
# Watch the latest batch (single report mode)
|
|
147
147
|
tem watch ./tem.db --latest
|
|
148
148
|
|
|
149
149
|
# Watch specific batch with 10-second refresh
|
|
@@ -152,8 +152,8 @@ tem watch ./tem.db my-batch-code --interval 10
|
|
|
152
152
|
# Watch for up to 5 minutes
|
|
153
153
|
tem watch ./tem.db --latest --timeout 300
|
|
154
154
|
|
|
155
|
-
# Watch
|
|
156
|
-
tem watch ./tem.db --latest --
|
|
155
|
+
# Watch with appended reports (scrollable history)
|
|
156
|
+
tem watch ./tem.db --latest --append
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
**Watch display includes:**
|
|
@@ -33,7 +33,7 @@ interface RecentError {
|
|
|
33
33
|
interface WatchOptions {
|
|
34
34
|
interval: number;
|
|
35
35
|
timeout: number;
|
|
36
|
-
|
|
36
|
+
append: boolean;
|
|
37
37
|
latest: boolean;
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -422,7 +422,7 @@ export async function watchCommand(
|
|
|
422
422
|
const options: WatchOptions = {
|
|
423
423
|
interval: (parseInt(String(flags['interval'] || '5'), 10) || 5) * 1000,
|
|
424
424
|
timeout: (parseInt(String(flags['timeout'] || '3600'), 10) || 3600) * 1000,
|
|
425
|
-
|
|
425
|
+
append: flags['append'] === true,
|
|
426
426
|
latest: flags['latest'] === true,
|
|
427
427
|
};
|
|
428
428
|
|
|
@@ -499,7 +499,7 @@ export async function watchCommand(
|
|
|
499
499
|
});
|
|
500
500
|
|
|
501
501
|
// Initial render
|
|
502
|
-
if (!options.
|
|
502
|
+
if (!options.append) clearScreen();
|
|
503
503
|
const timing = getTaskTiming(db, batchId);
|
|
504
504
|
const recentErrors = getRecentErrors(db, batchId, 3);
|
|
505
505
|
const stuckCount = getStuckTaskCount(db, batchId);
|
|
@@ -511,7 +511,7 @@ export async function watchCommand(
|
|
|
511
511
|
// Check timeout
|
|
512
512
|
if (Date.now() - state.startTime > options.timeout) {
|
|
513
513
|
clearInterval(intervalId);
|
|
514
|
-
if (!options.
|
|
514
|
+
if (!options.append) clearScreen();
|
|
515
515
|
console.error('Watch timeout reached');
|
|
516
516
|
db.close();
|
|
517
517
|
process.exit(1);
|
|
@@ -520,7 +520,7 @@ export async function watchCommand(
|
|
|
520
520
|
// Check if should exit
|
|
521
521
|
if (state.shouldExit) {
|
|
522
522
|
clearInterval(intervalId);
|
|
523
|
-
if (!options.
|
|
523
|
+
if (!options.append) clearScreen();
|
|
524
524
|
console.log('\nWatch interrupted by user');
|
|
525
525
|
db.close();
|
|
526
526
|
process.exit(state.exitCode);
|
|
@@ -536,7 +536,12 @@ export async function watchCommand(
|
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
// Render update
|
|
539
|
-
if (
|
|
539
|
+
if (options.append) {
|
|
540
|
+
// Print separator between reports in append mode
|
|
541
|
+
console.log('\n' + '─'.repeat(70));
|
|
542
|
+
} else {
|
|
543
|
+
clearScreen();
|
|
544
|
+
}
|
|
540
545
|
const timing = getTaskTiming(db, batchId);
|
|
541
546
|
const recentErrors = getRecentErrors(db, batchId, 3);
|
|
542
547
|
const stuckCount = getStuckTaskCount(db, batchId);
|
|
@@ -545,7 +550,11 @@ export async function watchCommand(
|
|
|
545
550
|
// Check if batch is done
|
|
546
551
|
if (!shouldContinueWatching(summary)) {
|
|
547
552
|
clearInterval(intervalId);
|
|
548
|
-
if (
|
|
553
|
+
if (options.append) {
|
|
554
|
+
console.log('\n' + '═'.repeat(70));
|
|
555
|
+
} else {
|
|
556
|
+
clearScreen();
|
|
557
|
+
}
|
|
549
558
|
console.log(renderFinalReport(summary, timing, recentErrors, stuckCount, state));
|
|
550
559
|
db.close();
|
|
551
560
|
process.exit(0);
|
package/src/cli/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ Watch command options:
|
|
|
29
29
|
--latest Use the most recently created batch
|
|
30
30
|
--interval N Refresh interval in seconds (default: 5)
|
|
31
31
|
--timeout N Maximum watch time in seconds (default: 3600)
|
|
32
|
-
--
|
|
32
|
+
--append Append reports instead of clearing screen
|
|
33
33
|
|
|
34
34
|
Examples:
|
|
35
35
|
tem report ./test.db # Summary of all batches
|