mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 22:28:10 +09:00
* Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T14:51:49Z - Changes: 6 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T14:52:35Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T14:53:20Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T14:54:04Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T14:56:07Z - Changes: 5 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:01:14Z - Changes: 3 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(plugins): complete IPFS plugin registry implementation v3.0.0-alpha.171 - Add live IPFS registry support with multi-gateway fallback - Add Ed25519 signature verification for registries - Add publish-registry.ts script for Pinata publishing - Add comprehensive setup guide for Google Cloud + Pinata - Fix ES module compatibility in publish script - Demo mode fallback with real npm download stats IPFS Capabilities: - Resolve IPNS names via multiple gateways - Fetch content from IPFS with automatic fallback - Verify Ed25519 signatures on registries - Check content availability across gateways - Support for both CIDv0 and CIDv1 formats Gateway Support: - Pinata (primary) - Cloudflare IPFS - ipfs.io - dweb.link - w3s.link Co-Authored-By: claude-flow <ruv@ruv.net> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:13:28Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:14:15Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:15:33Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:15:52Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:16:56Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(plugins): live IPFS plugin registry v3.0.0-alpha.172 IPFS Plugin Registry is now live: - CID: bafkreictvxdrcuku2yivzvagm24aocjkuwsezg7hvnyxvqf2pksixvareq - 6 official plugins pinned on Pinata - Multi-gateway fallback (Pinata, ipfs.io, dweb.link) - Direct CID detection (skips slow IPNS resolution) - Ed25519 signature verification ready Features: - Plugin discovery from live IPFS - Model import/export capability (Cloud Function) - Plugin sharing and tracking analytics - Download tracking support Cloud Function included: - Secure publishing via Secret Manager - Live npm stats fetching - Analytics tracking - Model import/export endpoints Tested: npx claude-flow@latest plugins list Co-Authored-By: claude-flow <ruv@ruv.net> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:20:55Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(plugins): full 19-plugin IPFS registry v3.0.0-alpha.173 Updated CID with all 19 official plugins: - CID: bafkreiahw4ufxwycbwwswt7rgbx6hkgnvg3rophhocatgec4bu5e7tzk2a Plugins now live on IPFS: - @claude-flow/embeddings (2,684 downloads) - @claude-flow/security (520 downloads) - @claude-flow/plugin-agentic-qe (289 downloads) - @claude-flow/plugin-prime-radiant (216 downloads) - @claude-flow/claims (156 downloads) - @claude-flow/plugin-gastown-bridge (150 downloads) - @claude-flow/neural (94 downloads) - @claude-flow/plugins (44 downloads) - @claude-flow/performance (22 downloads) - Plus 10 more specialized plugins Co-Authored-By: claude-flow <ruv@ruv.net> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:28:55Z - Changes: 6 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:29:59Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:31:16Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:31:31Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:32:58Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:33:21Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:33:22Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:33:52Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:34:07Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:34:25Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:34:44Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:34:55Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:35:11Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:36:39Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:40:37Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:40:47Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:41:16Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:43:05Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:43:42Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:44:59Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T15:55:29Z - Changes: 6 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:05:09Z - Changes: 7 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:05:26Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:05:43Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:06:13Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:08:14Z - Changes: 6 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:08:15Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:08:16Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:08:17Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:08:18Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:14:26Z - Changes: 5 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:14:42Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:15:56Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:16:22Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:16:46Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:16:52Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:17:56Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:19:18Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:19:25Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:20:25Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:23:27Z - Changes: 5 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:23:34Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:24:05Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:28:10Z - Changes: 8 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:35:35Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:35:43Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:35:55Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:36:11Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:36:25Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:36:33Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:36:41Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:37:08Z - Changes: 2 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:38:21Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:38:35Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:38:49Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:40:19Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:40:51Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:41:25Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:42:15Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:42:49Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:43:19Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:43:26Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:43:32Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:43:55Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:44:10Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T16:57:56Z - Changes: 10 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:04:11Z - Changes: 5 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:04:23Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:06:15Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:06:39Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:07:42Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:08:13Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T17:10:36Z - Changes: 3 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:04:31Z - Changes: 8 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:05:06Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:05:41Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:05:55Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:06:28Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:06:36Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:07:34Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:11:33Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:12:22Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Checkpoint: File edits Automatic checkpoint created by Claude Code - Branch: feature/ipfs-plugin-registry - Timestamp: 2026-01-24T18:13:00Z - Changes: 1 file(s) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
500 lines
14 KiB
JavaScript
500 lines
14 KiB
JavaScript
/**
|
|
* Claude Flow Plugin Registry Cloud Function
|
|
*
|
|
* Secure IPFS publishing with:
|
|
* - Ed25519 signature verification
|
|
* - Model import/export tracking
|
|
* - Plugin sharing analytics
|
|
* - Download tracking
|
|
*
|
|
* Deploy:
|
|
* gcloud functions deploy publish-registry \
|
|
* --gen2 --runtime=nodejs20 --region=us-central1 \
|
|
* --trigger-http --allow-unauthenticated \
|
|
* --service-account=plugin-registry-publisher@claude-flow.iam.gserviceaccount.com
|
|
*/
|
|
|
|
import { SecretManagerServiceClient } from '@google-cloud/secret-manager';
|
|
import { Storage } from '@google-cloud/storage';
|
|
import * as ed from '@noble/ed25519';
|
|
|
|
const secretManager = new SecretManagerServiceClient();
|
|
const storage = new Storage();
|
|
|
|
const PROJECT_ID = process.env.GCP_PROJECT || 'claude-flow';
|
|
const BUCKET_NAME = 'claude-flow-plugin-registry';
|
|
const PINATA_API_URL = 'https://api.pinata.cloud';
|
|
|
|
/**
|
|
* Get secret from Secret Manager
|
|
*/
|
|
async function getSecret(name) {
|
|
const [version] = await secretManager.accessSecretVersion({
|
|
name: `projects/${PROJECT_ID}/secrets/${name}/versions/latest`,
|
|
});
|
|
return version.payload.data.toString();
|
|
}
|
|
|
|
/**
|
|
* Sign registry with Ed25519
|
|
*/
|
|
async function signRegistry(registry, privateKeyHex) {
|
|
const privateKey = Buffer.from(privateKeyHex, 'hex');
|
|
const publicKey = await ed.getPublicKeyAsync(privateKey);
|
|
|
|
// Create copy without signature fields
|
|
const registryToSign = { ...registry };
|
|
delete registryToSign.registrySignature;
|
|
delete registryToSign.registryPublicKey;
|
|
|
|
const message = JSON.stringify(registryToSign);
|
|
const signature = await ed.signAsync(
|
|
new TextEncoder().encode(message),
|
|
privateKey
|
|
);
|
|
|
|
return {
|
|
signature: Buffer.from(signature).toString('hex'),
|
|
publicKey: `ed25519:${Buffer.from(publicKey).toString('hex')}`,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Pin JSON to IPFS via Pinata
|
|
*/
|
|
async function pinToIPFS(data, name, jwt) {
|
|
const response = await fetch(`${PINATA_API_URL}/pinning/pinJSONToIPFS`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Authorization': `Bearer ${jwt}`,
|
|
},
|
|
body: JSON.stringify({
|
|
pinataContent: data,
|
|
pinataMetadata: {
|
|
name,
|
|
keyvalues: {
|
|
type: 'plugin-registry',
|
|
publishedAt: new Date().toISOString(),
|
|
version: data.version || '1.0.0',
|
|
},
|
|
},
|
|
pinataOptions: {
|
|
cidVersion: 1,
|
|
},
|
|
}),
|
|
});
|
|
|
|
if (!response.ok) {
|
|
const error = await response.text();
|
|
throw new Error(`Pinata error: ${response.status} - ${error}`);
|
|
}
|
|
|
|
return response.json();
|
|
}
|
|
|
|
/**
|
|
* Fetch npm stats for packages
|
|
*/
|
|
async function fetchNpmStats(packageName) {
|
|
try {
|
|
const [downloadsRes, packageRes] = await Promise.all([
|
|
fetch(`https://api.npmjs.org/downloads/point/last-week/${encodeURIComponent(packageName)}`, {
|
|
signal: AbortSignal.timeout(5000),
|
|
}),
|
|
fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {
|
|
signal: AbortSignal.timeout(5000),
|
|
}),
|
|
]);
|
|
|
|
const downloads = downloadsRes.ok ? (await downloadsRes.json()).downloads || 0 : 0;
|
|
const version = packageRes.ok ? (await packageRes.json()).version || 'unknown' : 'unknown';
|
|
|
|
return { downloads, version };
|
|
} catch {
|
|
return { downloads: 0, version: 'unknown' };
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Track plugin download/share event
|
|
*/
|
|
async function trackEvent(bucket, eventType, pluginId, metadata = {}) {
|
|
const file = bucket.file(`analytics/${eventType}/${new Date().toISOString().split('T')[0]}.jsonl`);
|
|
const event = JSON.stringify({
|
|
timestamp: new Date().toISOString(),
|
|
eventType,
|
|
pluginId,
|
|
...metadata,
|
|
}) + '\n';
|
|
|
|
try {
|
|
await file.save(event, { resumable: false });
|
|
} catch {
|
|
// Append to existing file
|
|
const [exists] = await file.exists();
|
|
if (exists) {
|
|
const [content] = await file.download();
|
|
await file.save(content.toString() + event);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Export model/pattern to IPFS
|
|
*/
|
|
async function exportModel(modelData, jwt) {
|
|
const result = await pinToIPFS(modelData, `claude-flow-model-${Date.now()}`, jwt);
|
|
return {
|
|
cid: result.IpfsHash,
|
|
size: result.PinSize,
|
|
gateways: [
|
|
`https://gateway.pinata.cloud/ipfs/${result.IpfsHash}`,
|
|
`https://ipfs.io/ipfs/${result.IpfsHash}`,
|
|
],
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Import model from IPFS CID
|
|
*/
|
|
async function importModel(cid) {
|
|
const gateways = [
|
|
'https://gateway.pinata.cloud',
|
|
'https://ipfs.io',
|
|
'https://dweb.link',
|
|
];
|
|
|
|
for (const gateway of gateways) {
|
|
try {
|
|
const response = await fetch(`${gateway}/ipfs/${cid}`, {
|
|
signal: AbortSignal.timeout(30000),
|
|
headers: { 'Accept': 'application/json' },
|
|
});
|
|
|
|
if (response.ok) {
|
|
return {
|
|
success: true,
|
|
data: await response.json(),
|
|
gateway,
|
|
};
|
|
}
|
|
} catch {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
return { success: false, error: 'Model not found on any gateway' };
|
|
}
|
|
|
|
/**
|
|
* Main Cloud Function handler
|
|
*/
|
|
export async function publishRegistry(req, res) {
|
|
// CORS headers
|
|
res.set('Access-Control-Allow-Origin', '*');
|
|
res.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
res.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
|
|
|
if (req.method === 'OPTIONS') {
|
|
return res.status(204).send('');
|
|
}
|
|
|
|
try {
|
|
const { action = 'publish' } = req.query;
|
|
const bucket = storage.bucket(BUCKET_NAME);
|
|
|
|
switch (action) {
|
|
case 'publish': {
|
|
// Get secrets
|
|
const [pinataJwt, privateKey] = await Promise.all([
|
|
getSecret('pinata-jwt'),
|
|
getSecret('registry-private-key'),
|
|
]);
|
|
|
|
// Fetch registry from GCS
|
|
const file = bucket.file('registry.json');
|
|
const [content] = await file.download();
|
|
const registry = JSON.parse(content.toString());
|
|
|
|
// Update timestamps and fetch live npm stats
|
|
registry.updatedAt = new Date().toISOString();
|
|
|
|
// Fetch live stats for each plugin
|
|
for (const plugin of registry.plugins) {
|
|
const stats = await fetchNpmStats(plugin.id);
|
|
plugin.downloads = stats.downloads;
|
|
plugin.version = stats.version !== 'unknown' ? stats.version : plugin.version;
|
|
}
|
|
|
|
registry.totalDownloads = registry.plugins.reduce((sum, p) => sum + p.downloads, 0);
|
|
|
|
// Sign registry
|
|
const { signature, publicKey } = await signRegistry(registry, privateKey);
|
|
registry.registrySignature = signature;
|
|
registry.registryPublicKey = publicKey;
|
|
|
|
// Pin to IPFS
|
|
const pinResult = await pinToIPFS(registry, 'claude-flow-plugin-registry', pinataJwt);
|
|
|
|
// Save latest CID to GCS
|
|
await bucket.file('latest-cid.txt').save(pinResult.IpfsHash);
|
|
|
|
// Track publish event
|
|
await trackEvent(bucket, 'publish', 'registry', {
|
|
cid: pinResult.IpfsHash,
|
|
pluginCount: registry.plugins.length,
|
|
});
|
|
|
|
return res.json({
|
|
success: true,
|
|
cid: pinResult.IpfsHash,
|
|
updatedAt: registry.updatedAt,
|
|
pluginCount: registry.plugins.length,
|
|
totalDownloads: registry.totalDownloads,
|
|
gateways: [
|
|
`https://gateway.pinata.cloud/ipfs/${pinResult.IpfsHash}`,
|
|
`https://ipfs.io/ipfs/${pinResult.IpfsHash}`,
|
|
`https://dweb.link/ipfs/${pinResult.IpfsHash}`,
|
|
],
|
|
publicKey,
|
|
});
|
|
}
|
|
|
|
case 'export-model': {
|
|
const pinataJwt = await getSecret('pinata-jwt');
|
|
const modelData = req.body;
|
|
|
|
if (!modelData) {
|
|
return res.status(400).json({ error: 'Model data required' });
|
|
}
|
|
|
|
const result = await exportModel(modelData, pinataJwt);
|
|
await trackEvent(bucket, 'model-export', modelData.id || 'unknown');
|
|
|
|
return res.json({
|
|
success: true,
|
|
...result,
|
|
});
|
|
}
|
|
|
|
case 'import-model': {
|
|
const { cid } = req.query;
|
|
|
|
if (!cid) {
|
|
return res.status(400).json({ error: 'CID required' });
|
|
}
|
|
|
|
const result = await importModel(cid);
|
|
await trackEvent(bucket, 'model-import', cid);
|
|
|
|
return res.json(result);
|
|
}
|
|
|
|
case 'track-download': {
|
|
const { pluginId } = req.body || req.query;
|
|
|
|
if (!pluginId) {
|
|
return res.status(400).json({ error: 'Plugin ID required' });
|
|
}
|
|
|
|
await trackEvent(bucket, 'download', pluginId);
|
|
return res.json({ success: true });
|
|
}
|
|
|
|
case 'analytics': {
|
|
const { period = '7d' } = req.query;
|
|
|
|
// Read analytics files
|
|
const [files] = await bucket.getFiles({ prefix: 'analytics/' });
|
|
const analytics = {
|
|
downloads: {},
|
|
exports: 0,
|
|
imports: 0,
|
|
publishes: 0,
|
|
};
|
|
|
|
for (const file of files.slice(-7)) { // Last 7 files
|
|
try {
|
|
const [content] = await file.download();
|
|
const lines = content.toString().split('\n').filter(Boolean);
|
|
for (const line of lines) {
|
|
const event = JSON.parse(line);
|
|
if (event.eventType === 'download') {
|
|
analytics.downloads[event.pluginId] = (analytics.downloads[event.pluginId] || 0) + 1;
|
|
} else if (event.eventType === 'model-export') {
|
|
analytics.exports++;
|
|
} else if (event.eventType === 'model-import') {
|
|
analytics.imports++;
|
|
} else if (event.eventType === 'publish') {
|
|
analytics.publishes++;
|
|
}
|
|
}
|
|
} catch {
|
|
continue;
|
|
}
|
|
}
|
|
|
|
return res.json(analytics);
|
|
}
|
|
|
|
case 'status': {
|
|
// Get latest CID
|
|
try {
|
|
const [content] = await bucket.file('latest-cid.txt').download();
|
|
const cid = content.toString().trim();
|
|
|
|
return res.json({
|
|
healthy: true,
|
|
latestCid: cid,
|
|
gateways: [
|
|
`https://gateway.pinata.cloud/ipfs/${cid}`,
|
|
`https://ipfs.io/ipfs/${cid}`,
|
|
],
|
|
});
|
|
} catch {
|
|
return res.json({
|
|
healthy: false,
|
|
error: 'No registry published yet',
|
|
});
|
|
}
|
|
}
|
|
|
|
case 'rate': {
|
|
// Rate a plugin or model (stored in GCS, no SQL)
|
|
const { itemId, itemType = 'plugin', rating, userId } = req.body || {};
|
|
|
|
if (!itemId || !rating || rating < 1 || rating > 5) {
|
|
return res.status(400).json({ error: 'itemId and rating (1-5) required' });
|
|
}
|
|
|
|
// Generate anonymous user ID if not provided
|
|
const finalUserId = userId || `anon-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
|
|
// Store rating in GCS (JSON file per item)
|
|
const ratingsFile = bucket.file(`ratings/${itemType}/${itemId}.json`);
|
|
let ratings = { ratings: [], average: 0, count: 0 };
|
|
|
|
try {
|
|
const [exists] = await ratingsFile.exists();
|
|
if (exists) {
|
|
const [content] = await ratingsFile.download();
|
|
ratings = JSON.parse(content.toString());
|
|
}
|
|
} catch {
|
|
// File doesn't exist, use defaults
|
|
}
|
|
|
|
// Check if user already rated (prevent duplicate ratings)
|
|
const existingIndex = ratings.ratings.findIndex(r => r.userId === finalUserId);
|
|
if (existingIndex >= 0) {
|
|
// Update existing rating
|
|
ratings.ratings[existingIndex] = {
|
|
userId: finalUserId,
|
|
rating: Number(rating),
|
|
timestamp: new Date().toISOString(),
|
|
};
|
|
} else {
|
|
// Add new rating
|
|
ratings.ratings.push({
|
|
userId: finalUserId,
|
|
rating: Number(rating),
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
}
|
|
|
|
// Recalculate average
|
|
ratings.count = ratings.ratings.length;
|
|
ratings.average = ratings.ratings.reduce((sum, r) => sum + r.rating, 0) / ratings.count;
|
|
|
|
// Save updated ratings
|
|
await ratingsFile.save(JSON.stringify(ratings, null, 2), {
|
|
contentType: 'application/json',
|
|
});
|
|
|
|
// Track rating event
|
|
await trackEvent(bucket, 'rating', itemId, { rating, itemType });
|
|
|
|
return res.json({
|
|
success: true,
|
|
itemId,
|
|
average: Math.round(ratings.average * 10) / 10,
|
|
count: ratings.count,
|
|
});
|
|
}
|
|
|
|
case 'get-ratings': {
|
|
// Get ratings for a plugin or model
|
|
const { itemId, itemType = 'plugin' } = req.query;
|
|
|
|
if (!itemId) {
|
|
return res.status(400).json({ error: 'itemId required' });
|
|
}
|
|
|
|
const ratingsFile = bucket.file(`ratings/${itemType}/${itemId}.json`);
|
|
|
|
try {
|
|
const [exists] = await ratingsFile.exists();
|
|
if (!exists) {
|
|
return res.json({ itemId, average: 0, count: 0, ratings: [] });
|
|
}
|
|
|
|
const [content] = await ratingsFile.download();
|
|
const ratings = JSON.parse(content.toString());
|
|
|
|
return res.json({
|
|
itemId,
|
|
average: Math.round(ratings.average * 10) / 10,
|
|
count: ratings.count,
|
|
// Don't expose individual user ratings
|
|
});
|
|
} catch {
|
|
return res.json({ itemId, average: 0, count: 0 });
|
|
}
|
|
}
|
|
|
|
case 'bulk-ratings': {
|
|
// Get ratings for multiple items at once
|
|
const { itemIds, itemType = 'plugin' } = req.body || req.query;
|
|
|
|
if (!itemIds || !Array.isArray(itemIds)) {
|
|
return res.status(400).json({ error: 'itemIds array required' });
|
|
}
|
|
|
|
const results = {};
|
|
|
|
for (const itemId of itemIds.slice(0, 50)) { // Limit to 50 items
|
|
try {
|
|
const ratingsFile = bucket.file(`ratings/${itemType}/${itemId}.json`);
|
|
const [exists] = await ratingsFile.exists();
|
|
|
|
if (exists) {
|
|
const [content] = await ratingsFile.download();
|
|
const ratings = JSON.parse(content.toString());
|
|
results[itemId] = {
|
|
average: Math.round(ratings.average * 10) / 10,
|
|
count: ratings.count,
|
|
};
|
|
} else {
|
|
results[itemId] = { average: 0, count: 0 };
|
|
}
|
|
} catch {
|
|
results[itemId] = { average: 0, count: 0 };
|
|
}
|
|
}
|
|
|
|
return res.json(results);
|
|
}
|
|
|
|
default:
|
|
return res.status(400).json({ error: `Unknown action: ${action}` });
|
|
}
|
|
} catch (error) {
|
|
console.error('Function error:', error);
|
|
return res.status(500).json({ error: error.message });
|
|
}
|
|
}
|
|
|
|
// For local testing
|
|
export { signRegistry, fetchNpmStats, trackEvent };
|