@cloud411716/fancy-webnovel 1.0.10 → 1.0.11

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.
@@ -110,6 +110,10 @@ const scan = {
110
110
 
111
111
  const SCRAPERS = { qidian, fanqie, jinjiang, qimao };
112
112
 
113
+ // ASCII spinner sequence for live progress feedback during scraping
114
+ const SPINNER = ['|', '/', '—', '\\'];
115
+ let _spinnerIdx = 0;
116
+
113
117
  /**
114
118
  * @param {object} ctx - Cordis plugin context
115
119
  */
@@ -190,6 +194,22 @@ export function apply(ctx) {
190
194
  }
191
195
 
192
196
  // ---------- in-process scraping (no subprocess) ----------
197
+
198
+ // Register scan-progress listeners before scraping starts, clean up after.
199
+ // Each fired event sends an ASCII spinner followup so the user sees live
200
+ // progress instead of a blank screen while the scraper runs.
201
+ const disposers = [];
202
+ let currentRankLabel = '';
203
+
204
+ disposers.push(ctx.events.on('fancy/scan:start', (_ctx, platform, _channel, _type, label) => {
205
+ currentRankLabel = label;
206
+ llmFollowup(invocation, `[${SPINNER[_spinnerIdx++ % 4]}] 正在采集:${platformLabel(platform)} ${label} …`);
207
+ }));
208
+
209
+ disposers.push(ctx.events.on('fancy/scan:rank-done', (_ctx, _platform, _channel, _type, ok, written) => {
210
+ llmFollowup(invocation, `[${SPINNER[_spinnerIdx++ % 4]}] ${currentRankLabel} ${ok ? `✓ 写入 ${written} 条` : '✗ 失败'}`);
211
+ }));
212
+
193
213
  const { totalBooks, totalFiles, failedRanks, lastReceipt } = await runScans(
194
214
  ctx,
195
215
  projectRoot,
@@ -197,6 +217,9 @@ export function apply(ctx) {
197
217
  signal,
198
218
  );
199
219
 
220
+ // Clean up progress listeners; runScans is done.
221
+ for (const d of disposers) d();
222
+
200
223
  // ---------- output results ----------
201
224
  if (lastReceipt && totalFiles > 0) {
202
225
  notify(session, scan.notify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {