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