@chappibunny/repolens 0.6.0 → 0.6.2

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.
@@ -327,235 +327,3 @@ export async function replacePageContent(pageId, markdown) {
327
327
  }
328
328
  }
329
329
 
330
- /**
331
- * Publish dashboard metrics to Notion
332
- * @param {string} parentPageId - Parent page ID
333
- * @param {object} metrics - Metrics data
334
- * @param {object} config - Configuration
335
- */
336
- export async function publishDashboardToNotion(parentPageId, metrics, config) {
337
- const { healthScore, coverage, freshness, quality, trends = {} } = metrics;
338
- const projectName = config.project?.name || "Project";
339
-
340
- const currentBranch = getCurrentBranch();
341
- const baseTitle = `${config.project.docs_title_prefix || "Documentation"} — Dashboard`;
342
- const title = getBranchQualifiedTitle(baseTitle, currentBranch, config.notion?.includeBranchInTitle !== false);
343
- const cacheKey = `dashboard-${currentBranch}`;
344
-
345
- log(`Publishing dashboard to Notion: "${title}"`);
346
-
347
- const pageId = await ensurePage(parentPageId, title, cacheKey);
348
- await unarchivePage(pageId);
349
- await clearPage(pageId);
350
-
351
- // Build Notion blocks for dashboard
352
- const blocks = [];
353
-
354
- // Header
355
- blocks.push({
356
- object: "block",
357
- type: "heading_1",
358
- heading_1: {
359
- rich_text: [{ type: "text", text: { content: `📊 ${projectName} Documentation Dashboard` } }]
360
- }
361
- });
362
-
363
- // Health Score Section
364
- blocks.push({
365
- object: "block",
366
- type: "heading_2",
367
- heading_2: {
368
- rich_text: [{ type: "text", text: { content: "🏥 Health Score" } }]
369
- }
370
- });
371
-
372
- const scoreLabel = healthScore >= 80 ? "Excellent" : healthScore >= 60 ? "Good" : healthScore >= 40 ? "Fair" : "Poor";
373
- const scoreEmoji = healthScore >= 80 ? "🟢" : healthScore >= 60 ? "🔵" : healthScore >= 40 ? "🟡" : "🔴";
374
-
375
- blocks.push({
376
- object: "block",
377
- type: "callout",
378
- callout: {
379
- rich_text: [{
380
- type: "text",
381
- text: { content: `${scoreEmoji} Score: ${healthScore}/100 (${scoreLabel})` }
382
- }],
383
- icon: { emoji: "💚" }
384
- }
385
- });
386
-
387
- // Coverage Section
388
- blocks.push({
389
- object: "block",
390
- type: "heading_2",
391
- heading_2: {
392
- rich_text: [{ type: "text", text: { content: "📈 Coverage Metrics" } }]
393
- }
394
- });
395
-
396
- blocks.push({
397
- object: "block",
398
- type: "bulleted_list_item",
399
- bulleted_list_item: {
400
- rich_text: [{ type: "text", text: { content: `Overall Coverage: ${coverage.overall}%` }, annotations: { bold: true } }]
401
- }
402
- });
403
-
404
- blocks.push({
405
- object: "block",
406
- type: "bulleted_list_item",
407
- bulleted_list_item: {
408
- rich_text: [{ type: "text", text: { content: `Modules: ${coverage.modules.documented}/${coverage.modules.total} (${coverage.modules.percentage}%)` } }]
409
- }
410
- });
411
-
412
- blocks.push({
413
- object: "block",
414
- type: "bulleted_list_item",
415
- bulleted_list_item: {
416
- rich_text: [{ type: "text", text: { content: `APIs: ${coverage.apis.documented}/${coverage.apis.total} (${coverage.apis.percentage}%)` } }]
417
- }
418
- });
419
-
420
- blocks.push({
421
- object: "block",
422
- type: "bulleted_list_item",
423
- bulleted_list_item: {
424
- rich_text: [{ type: "text", text: { content: `Pages: ${coverage.pages.documented}/${coverage.pages.total} (${coverage.pages.percentage}%)` } }]
425
- }
426
- });
427
-
428
- // Freshness Section
429
- if (freshness && freshness.lastUpdated) {
430
- blocks.push({
431
- object: "block",
432
- type: "heading_2",
433
- heading_2: {
434
- rich_text: [{ type: "text", text: { content: "🕐 Freshness" } }]
435
- }
436
- });
437
-
438
- const freshnessStatus = freshness.isStale ? "⚠️ Stale" : "✅ Fresh";
439
- blocks.push({
440
- object: "block",
441
- type: "paragraph",
442
- paragraph: {
443
- rich_text: [{
444
- type: "text",
445
- text: { content: `Last Updated: ${new Date(freshness.lastUpdated).toLocaleDateString()} (${freshness.daysSinceUpdate} days ago) ${freshnessStatus}` }
446
- }]
447
- }
448
- });
449
- }
450
-
451
- // Quality Issues Section
452
- blocks.push({
453
- object: "block",
454
- type: "heading_2",
455
- heading_2: {
456
- rich_text: [{ type: "text", text: { content: "🔍 Quality Issues" } }]
457
- }
458
- });
459
-
460
- if (quality.issues.length > 0) {
461
- blocks.push({
462
- object: "block",
463
- type: "paragraph",
464
- paragraph: {
465
- rich_text: [{
466
- type: "text",
467
- text: { content: `Found ${quality.issues.length} issues: ${quality.summary.high} High, ${quality.summary.medium} Medium, ${quality.summary.low} Low` }
468
- }]
469
- }
470
- });
471
-
472
- quality.issues.slice(0, 10).forEach(issue => {
473
- const emoji = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
474
- blocks.push({
475
- object: "block",
476
- type: "bulleted_list_item",
477
- bulleted_list_item: {
478
- rich_text: [{
479
- type: "text",
480
- text: { content: `${emoji} ${issue.message}${issue.count ? ` (${issue.count})` : ""}` }
481
- }]
482
- }
483
- });
484
- });
485
- } else {
486
- blocks.push({
487
- object: "block",
488
- type: "callout",
489
- callout: {
490
- rich_text: [{ type: "text", text: { content: "✨ No quality issues detected! Your documentation is in great shape." } }],
491
- icon: { emoji: "✅" }
492
- }
493
- });
494
- }
495
-
496
- // Trends Section
497
- if (trends.coverage || trends.health) {
498
- blocks.push({
499
- object: "block",
500
- type: "heading_2",
501
- heading_2: {
502
- rich_text: [{ type: "text", text: { content: "📊 Trends" } }]
503
- }
504
- });
505
-
506
- if (trends.coverage) {
507
- const trendEmoji = trends.coverage === "up" ? "📈" : trends.coverage === "down" ? "📉" : "➡️";
508
- blocks.push({
509
- object: "block",
510
- type: "bulleted_list_item",
511
- bulleted_list_item: {
512
- rich_text: [{ type: "text", text: { content: `${trendEmoji} Coverage trend: ${trends.coverage}` } }]
513
- }
514
- });
515
- }
516
-
517
- if (trends.health) {
518
- const trendEmoji = trends.health === "up" ? "📈" : trends.health === "down" ? "📉" : "➡️";
519
- blocks.push({
520
- object: "block",
521
- type: "bulleted_list_item",
522
- bulleted_list_item: {
523
- rich_text: [{ type: "text", text: { content: `${trendEmoji} Health trend: ${trends.health}` } }]
524
- }
525
- });
526
- }
527
- }
528
-
529
- // Footer - Powered by RABITAI
530
- blocks.push({
531
- object: "block",
532
- type: "divider",
533
- divider: {}
534
- });
535
-
536
- blocks.push({
537
- object: "block",
538
- type: "paragraph",
539
- paragraph: {
540
- rich_text: [
541
- { type: "text", text: { content: "Generated by " } },
542
- {
543
- type: "text",
544
- text: { content: "RABITAI", link: { url: "https://rabitai.io" } },
545
- annotations: { bold: true }
546
- },
547
- { type: "text", text: { content: " 🐰" } }
548
- ]
549
- }
550
- });
551
-
552
- // Append blocks to page
553
- for (let i = 0; i < blocks.length; i += 50) {
554
- const chunk = blocks.slice(i, i + 50);
555
- await notionRequest("PATCH", `/blocks/${pageId}/children`, {
556
- children: chunk
557
- });
558
- }
559
-
560
- log(`✓ Dashboard published to Notion: ${title}`);
561
- }