@coderule/mcp 1.4.0 → 1.5.0

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/dist/mcp-cli.js CHANGED
@@ -1690,6 +1690,63 @@ function collectIndexingStatus(runtime, runner) {
1690
1690
  service: runner.getServiceStateSnapshot()
1691
1691
  };
1692
1692
  }
1693
+ function formatStatus(status) {
1694
+ const lines = [];
1695
+ lines.push("=== Coderule Indexing Status ===");
1696
+ lines.push("");
1697
+ lines.push(`Timestamp: ${new Date(status.timestamp).toISOString()}`);
1698
+ lines.push("");
1699
+ lines.push("Repository:");
1700
+ lines.push(` ID: ${status.root.id}`);
1701
+ lines.push(` Path: ${status.root.path}`);
1702
+ lines.push("");
1703
+ lines.push("Files:");
1704
+ lines.push(` Total: ${status.files.total}`);
1705
+ lines.push(" States:");
1706
+ lines.push(` Clean: ${status.files.byState.clean}`);
1707
+ lines.push(` Dirty: ${status.files.byState.dirty}`);
1708
+ lines.push(` Hashing: ${status.files.byState.hashing}`);
1709
+ lines.push(` Missing: ${status.files.byState.missing}`);
1710
+ lines.push("");
1711
+ lines.push("Queue:");
1712
+ lines.push(` Pending: ${status.queue.pending}`);
1713
+ lines.push(` Processing: ${status.queue.processing}`);
1714
+ lines.push(` Done: ${status.queue.done}`);
1715
+ lines.push(` Failed: ${status.queue.failed}`);
1716
+ lines.push("");
1717
+ if (status.latestSnapshot) {
1718
+ lines.push("Latest Snapshot:");
1719
+ lines.push(` Hash: ${status.latestSnapshot.snapshot_hash}`);
1720
+ lines.push(` Files: ${status.latestSnapshot.files_count}`);
1721
+ lines.push(` Size: ${formatBytes(status.latestSnapshot.total_size)}`);
1722
+ lines.push(
1723
+ ` Created: ${new Date(status.latestSnapshot.created_at).toISOString()}`
1724
+ );
1725
+ } else {
1726
+ lines.push("Latest Snapshot: None");
1727
+ }
1728
+ lines.push("");
1729
+ lines.push("Service State:");
1730
+ lines.push(
1731
+ ` Last Change: ${new Date(status.service.lastChangeAt).toISOString()}`
1732
+ );
1733
+ lines.push(
1734
+ ` Last Snapshot Ready: ${new Date(status.service.lastSnapshotReadyAt).toISOString()}`
1735
+ );
1736
+ lines.push(
1737
+ ` Last Heartbeat: ${status.service.lastHeartbeatEnqueuedAt > 0 ? new Date(status.service.lastHeartbeatEnqueuedAt).toISOString() : "Never"}`
1738
+ );
1739
+ lines.push(` Watcher Ready: ${status.service.watcherReady ? "Yes" : "No"}`);
1740
+ lines.push(` Buffering: ${status.service.buffering ? "Yes" : "No"}`);
1741
+ return lines.join("\n");
1742
+ }
1743
+ function formatBytes(bytes) {
1744
+ if (bytes === 0) return "0 B";
1745
+ const units = ["B", "KB", "MB", "GB", "TB"];
1746
+ const k = 1024;
1747
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
1748
+ return `${(bytes / Math.pow(k, i)).toFixed(2)} ${units[i]}`;
1749
+ }
1693
1750
 
1694
1751
  // src/mcp/server.ts
1695
1752
  var SERVER_NAME = "coderule-scanner-mcp";
@@ -1712,7 +1769,7 @@ function createMcpServer({
1712
1769
  },
1713
1770
  async () => {
1714
1771
  const status = collectIndexingStatus(runtime, runner);
1715
- const text = JSON.stringify(status, null, 2);
1772
+ const text = formatStatus(status);
1716
1773
  return {
1717
1774
  content: [{ type: "text", text }]
1718
1775
  };
@@ -1751,20 +1808,11 @@ function createMcpServer({
1751
1808
  formatter: runtime.config.retrievalFormatter
1752
1809
  }
1753
1810
  );
1754
- const summary = {
1755
- snapshotHash: latest.snapshot_hash,
1756
- budgetTokens: effectiveBudget,
1757
- formatter: runtime.config.retrievalFormatter
1758
- };
1759
1811
  return {
1760
1812
  content: [
1761
1813
  {
1762
1814
  type: "text",
1763
1815
  text: result.formatted_output ?? "(no formatted output)"
1764
- },
1765
- {
1766
- type: "text",
1767
- text: JSON.stringify({ summary, result }, null, 2)
1768
1816
  }
1769
1817
  ]
1770
1818
  };