gitnexushub 0.4.4 → 0.4.5

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.
@@ -1,7 +1,22 @@
1
1
  import { resolveWikiContext } from './resolve-context.js';
2
2
  import { runWikiUploadSession } from './session.js';
3
3
  import { GnxError, ErrorCode } from './errors.js';
4
- import { info } from '../cli-helpers.js';
4
+ import { info, warn } from '../cli-helpers.js';
5
+ function formatBytes(n) {
6
+ if (n < 1024)
7
+ return `${n} B`;
8
+ if (n < 1024 * 1024)
9
+ return `${(n / 1024).toFixed(1)} KB`;
10
+ return `${(n / (1024 * 1024)).toFixed(2)} MB`;
11
+ }
12
+ function formatDuration(ms) {
13
+ const s = Math.floor(ms / 1000);
14
+ if (s < 60)
15
+ return `${s}s`;
16
+ const m = Math.floor(s / 60);
17
+ const rem = s % 60;
18
+ return `${m}m${rem.toString().padStart(2, '0')}s`;
19
+ }
5
20
  function slugify(name) {
6
21
  return name
7
22
  .toLowerCase()
@@ -283,7 +298,7 @@ export async function runWikiUpload(opts, deps) {
283
298
  summary: m.summary,
284
299
  files: m.files,
285
300
  }));
286
- info('Phase 3/3: streaming pages to Hub + generating overview...');
301
+ info(`Phase 3/3: streaming ${orderedModules.length} page(s) to Hub...`);
287
302
  let activeSessionId = null;
288
303
  const onAbort = async () => {
289
304
  if (!activeSessionId)
@@ -296,6 +311,12 @@ export async function runWikiUpload(opts, deps) {
296
311
  }
297
312
  };
298
313
  opts.abortSignal?.addEventListener('abort', onAbort, { once: true });
314
+ const total = orderedModules.length;
315
+ const titleBySlug = new Map(orderedModules.map((m) => [m.slug, m.title]));
316
+ const pageStartAt = new Map();
317
+ const runStartAt = Date.now();
318
+ let startedCount = 0;
319
+ let doneCount = 0;
299
320
  try {
300
321
  return await runWikiUploadSession({
301
322
  api: ctx.api,
@@ -310,6 +331,26 @@ export async function runWikiUpload(opts, deps) {
310
331
  onSessionStart: (id) => {
311
332
  activeSessionId = id;
312
333
  },
334
+ onPageStart: (slug) => {
335
+ startedCount += 1;
336
+ pageStartAt.set(slug, Date.now());
337
+ const title = titleBySlug.get(slug) ?? slug;
338
+ info(`[${startedCount}/${total}] ${title} — generating...`);
339
+ },
340
+ onPageDone: (slug, bytes) => {
341
+ doneCount += 1;
342
+ const startedAt = pageStartAt.get(slug) ?? Date.now();
343
+ const elapsed = formatDuration(Date.now() - startedAt);
344
+ const totalElapsed = formatDuration(Date.now() - runStartAt);
345
+ const pct = Math.round((doneCount / total) * 100);
346
+ const title = titleBySlug.get(slug) ?? slug;
347
+ info(`[${doneCount}/${total}] ${title} — uploaded (${formatBytes(bytes)}, ${elapsed}) · ${pct}% · total ${totalElapsed}`);
348
+ },
349
+ onPageFail: (slug, err) => {
350
+ const title = titleBySlug.get(slug) ?? slug;
351
+ const msg = err instanceof Error ? err.message : String(err);
352
+ warn(`[${startedCount}/${total}] ${title} — failed: ${msg}`);
353
+ },
313
354
  });
314
355
  }
315
356
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitnexushub",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "Connect your editor to GitNexus Hub — one command MCP setup + project context",
5
5
  "author": "Abhigyan Patwari",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",