How andrewyng/context-hub works
Context Hub is a curated, versioned documentation and agent-skill browser distributed as a CLI and MCP server. The main workflow is to search the registry, resolve a selected document’s language/version and reference files, fetch content, and return or save it; agents can add persistent local annotations and send feedback. The graph also includes content-index construction and optional telemetry. Relationships are limited to the README and supplied source excerpts/index; unsampled command internals are represented only where documented.
Main entry points: registry.js Registry and resolver · index.js CLI dispatcher · get.js Get command · telemetry.js Feedback API client
Components 23
User entry points
- CLI dispatcher
cli/src/index.js - MCP server
cli/src/mcp/server.js - MCP tools
cli/src/mcp/tools.js
Content discovery
- Search command
cli/src/commands/search.js - Registry and resolver
cli/src/lib/registry.js - BM25 ranking
cli/src/lib/bm25.js - Language normalization
cli/src/lib/normalize.js - Content index builder
cli/src/commands/build.js - Frontmatter parser
cli/src/lib/frontmatter.js
Fetch and learning
- Get command
cli/src/commands/get.js - Local annotations
cli/src/lib/annotations.js - Annotation command
cli/src/commands/annotate.js
Runtime services
- Registry and document cache
cli/src/lib/cache.js - Configuration
cli/src/lib/config.js - Output formatting
cli/src/lib/output.js
Feedback and signals
- Feedback command
cli/src/commands/feedback.js - Feedback API client
cli/src/lib/telemetry.js - Usage analytics
cli/src/lib/analytics.js - Anonymous identity
cli/src/lib/identity.js
Other components
- Agent or user
- Feedback service
- PostHog
- Content sources
Connections 33
- Agent or user → CLI dispatcher: runs commands
README.md - Agent or user → MCP server: uses tools
README.md - CLI dispatcher → Search command: registers
cli/src/index.js - CLI dispatcher → Get command: registers
cli/src/index.js - CLI dispatcher → Content index builder: registers
cli/src/index.js - CLI dispatcher → Feedback command: registers
cli/src/index.js - CLI dispatcher → Annotation command: registers
cli/src/index.js - Search command → Registry and resolver: searches entries
cli/src/commands/search.js - Registry and resolver → Registry and document cache: loads registries
cli/src/lib/registry.js - Registry and resolver → Configuration: reads sources
cli/src/lib/registry.js - Registry and resolver → BM25 ranking: ranks matches
cli/src/lib/registry.js - Registry and resolver → Language normalization: normalizes language
cli/src/lib/registry.js - Content index builder → Frontmatter parser: parses metadata
cli/src/commands/build.js - Content index builder → Content sources: indexes content
README.md - Get command → Registry and resolver: resolves entry
cli/src/commands/get.js - Get command → Registry and document cache: fetches files
cli/src/commands/get.js - Get command → Local annotations: reads notes
cli/src/commands/get.js - Get command → Output formatting: formats result
cli/src/commands/get.js - Annotation command → Local annotations: saves notes
cli/src/commands/annotate.js - MCP server → MCP tools: registers tools
cli/src/mcp/server.js - MCP tools → Registry and resolver: searches and resolves
cli/src/mcp/tools.js - MCP tools → Registry and document cache: fetches files
cli/src/mcp/tools.js - MCP tools → Local annotations: reads or writes
cli/src/mcp/tools.js - Feedback command → Registry and resolver: resolves entry
cli/src/commands/feedback.js - Feedback command → Feedback API client: sends rating
cli/src/commands/feedback.js - Feedback API client → Configuration: reads preferences
cli/src/lib/telemetry.js - Feedback API client → Anonymous identity: gets client identity
cli/src/lib/telemetry.js - Feedback API client → Feedback service: posts feedback
cli/src/lib/telemetry.js - CLI dispatcher → Usage analytics: tracks usage
cli/src/index.js - Search command → Usage analytics: tracks searches
cli/src/commands/search.js - Usage analytics → Feedback API client: checks opt-out
cli/src/lib/analytics.js - Usage analytics → Anonymous identity: identifies events
cli/src/lib/analytics.js - Usage analytics → PostHog: sends events
cli/src/lib/analytics.js