@robin7331/papyrus-cli 0.1.8 → 0.1.9
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/README.md +1 -1
- package/dist/cli.js +3 -19
- package/package.json +1 -1
- package/src/cli.ts +3 -23
package/README.md
CHANGED
|
@@ -197,7 +197,7 @@ papyrus ./docs --yes
|
|
|
197
197
|
- In default conversion (without `--prompt`/`--prompt-file`), the model returns structured JSON with `format` + `content`.
|
|
198
198
|
- Without `--format`, output extension follows model-selected content format (`.md` or `.txt`).
|
|
199
199
|
- With `--format`, only the output extension changes.
|
|
200
|
-
- Single-file input now also shows a live worker lane
|
|
200
|
+
- Single-file input now also shows a live worker lane in TTY while conversion is running.
|
|
201
201
|
- Folder input is scanned recursively for `.pdf` files and processed in parallel.
|
|
202
202
|
- In folder mode, `--output` must be a directory path and mirrored subfolders are preserved.
|
|
203
203
|
- OpenAI rate-limit (`429`) responses are retried automatically using `Retry-After` (when present) plus exponential backoff.
|
package/dist/cli.js
CHANGED
|
@@ -433,12 +433,10 @@ async function runWithConcurrency(items, concurrency, worker) {
|
|
|
433
433
|
});
|
|
434
434
|
await Promise.all(workers);
|
|
435
435
|
}
|
|
436
|
-
const SPINNER_FRAMES = ["-", "\\", "|", "/"];
|
|
437
436
|
class AsciiWorkerDashboard {
|
|
438
437
|
lanes;
|
|
439
438
|
total;
|
|
440
439
|
workerCount;
|
|
441
|
-
spinnerTimer;
|
|
442
440
|
completed = 0;
|
|
443
441
|
failed = 0;
|
|
444
442
|
renderedLineCount = 0;
|
|
@@ -446,15 +444,10 @@ class AsciiWorkerDashboard {
|
|
|
446
444
|
this.total = total;
|
|
447
445
|
this.workerCount = workerCount;
|
|
448
446
|
this.lanes = Array.from({ length: workerCount }, () => ({
|
|
449
|
-
state: "idle"
|
|
450
|
-
spinnerFrame: 0
|
|
447
|
+
state: "idle"
|
|
451
448
|
}));
|
|
452
449
|
process.stdout.write("\x1b[?25l");
|
|
453
450
|
this.render();
|
|
454
|
-
this.spinnerTimer = setInterval(() => {
|
|
455
|
-
this.tickSpinners();
|
|
456
|
-
this.render();
|
|
457
|
-
}, 100);
|
|
458
451
|
}
|
|
459
452
|
setSummary(completed, failed) {
|
|
460
453
|
this.completed = completed;
|
|
@@ -468,7 +461,7 @@ class AsciiWorkerDashboard {
|
|
|
468
461
|
}
|
|
469
462
|
lane.state = "running";
|
|
470
463
|
lane.file = file;
|
|
471
|
-
lane.message = "processing";
|
|
464
|
+
lane.message = "processing...";
|
|
472
465
|
this.render();
|
|
473
466
|
}
|
|
474
467
|
setWorkerDone(workerId, file, message) {
|
|
@@ -492,7 +485,6 @@ class AsciiWorkerDashboard {
|
|
|
492
485
|
this.render();
|
|
493
486
|
}
|
|
494
487
|
stop() {
|
|
495
|
-
clearInterval(this.spinnerTimer);
|
|
496
488
|
this.render();
|
|
497
489
|
process.stdout.write("\x1b[?25h");
|
|
498
490
|
}
|
|
@@ -521,17 +513,9 @@ class AsciiWorkerDashboard {
|
|
|
521
513
|
}
|
|
522
514
|
return lines;
|
|
523
515
|
}
|
|
524
|
-
tickSpinners() {
|
|
525
|
-
for (const lane of this.lanes) {
|
|
526
|
-
if (lane.state !== "running") {
|
|
527
|
-
continue;
|
|
528
|
-
}
|
|
529
|
-
lane.spinnerFrame = (lane.spinnerFrame + 1) % SPINNER_FRAMES.length;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
516
|
renderIcon(lane) {
|
|
533
517
|
if (lane.state === "running") {
|
|
534
|
-
return
|
|
518
|
+
return ">>";
|
|
535
519
|
}
|
|
536
520
|
if (lane.state === "done") {
|
|
537
521
|
return "OK";
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -583,20 +583,16 @@ async function runWithConcurrency<T>(
|
|
|
583
583
|
await Promise.all(workers);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
-
const SPINNER_FRAMES = ["-", "\\", "|", "/"];
|
|
587
|
-
|
|
588
586
|
type WorkerLane = {
|
|
589
587
|
state: "idle" | "running" | "done" | "failed";
|
|
590
588
|
file?: string;
|
|
591
589
|
message?: string;
|
|
592
|
-
spinnerFrame: number;
|
|
593
590
|
};
|
|
594
591
|
|
|
595
592
|
class AsciiWorkerDashboard {
|
|
596
593
|
private readonly lanes: WorkerLane[];
|
|
597
594
|
private readonly total: number;
|
|
598
595
|
private readonly workerCount: number;
|
|
599
|
-
private readonly spinnerTimer: NodeJS.Timeout;
|
|
600
596
|
private completed = 0;
|
|
601
597
|
private failed = 0;
|
|
602
598
|
private renderedLineCount = 0;
|
|
@@ -605,16 +601,11 @@ class AsciiWorkerDashboard {
|
|
|
605
601
|
this.total = total;
|
|
606
602
|
this.workerCount = workerCount;
|
|
607
603
|
this.lanes = Array.from({ length: workerCount }, () => ({
|
|
608
|
-
state: "idle"
|
|
609
|
-
spinnerFrame: 0
|
|
604
|
+
state: "idle"
|
|
610
605
|
}));
|
|
611
606
|
|
|
612
607
|
process.stdout.write("\x1b[?25l");
|
|
613
608
|
this.render();
|
|
614
|
-
this.spinnerTimer = setInterval(() => {
|
|
615
|
-
this.tickSpinners();
|
|
616
|
-
this.render();
|
|
617
|
-
}, 100);
|
|
618
609
|
}
|
|
619
610
|
|
|
620
611
|
setSummary(completed: number, failed: number): void {
|
|
@@ -631,7 +622,7 @@ class AsciiWorkerDashboard {
|
|
|
631
622
|
|
|
632
623
|
lane.state = "running";
|
|
633
624
|
lane.file = file;
|
|
634
|
-
lane.message = "processing";
|
|
625
|
+
lane.message = "processing...";
|
|
635
626
|
this.render();
|
|
636
627
|
}
|
|
637
628
|
|
|
@@ -660,7 +651,6 @@ class AsciiWorkerDashboard {
|
|
|
660
651
|
}
|
|
661
652
|
|
|
662
653
|
stop(): void {
|
|
663
|
-
clearInterval(this.spinnerTimer);
|
|
664
654
|
this.render();
|
|
665
655
|
process.stdout.write("\x1b[?25h");
|
|
666
656
|
}
|
|
@@ -696,19 +686,9 @@ class AsciiWorkerDashboard {
|
|
|
696
686
|
return lines;
|
|
697
687
|
}
|
|
698
688
|
|
|
699
|
-
private tickSpinners(): void {
|
|
700
|
-
for (const lane of this.lanes) {
|
|
701
|
-
if (lane.state !== "running") {
|
|
702
|
-
continue;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
lane.spinnerFrame = (lane.spinnerFrame + 1) % SPINNER_FRAMES.length;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
689
|
private renderIcon(lane: WorkerLane): string {
|
|
710
690
|
if (lane.state === "running") {
|
|
711
|
-
return
|
|
691
|
+
return ">>";
|
|
712
692
|
}
|
|
713
693
|
|
|
714
694
|
if (lane.state === "done") {
|