feat(cli): add phala docs — explore live docs from the terminal (agent-friendly) - #485
Merged
Conversation
Adds a `phala docs` command group that lets users — and especially AI coding agents — explore the live documentation on docs.phala.com directly from the terminal, with zero setup: - `phala docs search <query>` — relevance-ranked full-text search - `phala docs read <page>` — read full pages by path or docs URL - `phala docs tree [path] -L <depth>` — browse the docs site structure - `phala docs grep <pattern> [path]` — ripgrep across all docs content - `phala docs feedback <page> <msg>` — report doc issues to the docs team The commands talk to the hosted docs MCP server (https://docs.phala.com/mcp) over its stateless streamable-HTTP transport via a minimal wire-format client (src/lib/docs-mcp.ts) — no MCP SDK dependency. search uses the search_phala tool; read/tree/grep use the query_docs_filesystem_phala virtual filesystem tool. All subcommands support --json, require no authentication, and return actionable hints on failure. PHALA_DOCS_MCP_URL overrides the endpoint. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Leechael
approved these changes
Jul 31, 2026
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
phala docscommand group so users — and especially AI coding agents driving the CLI — can explore everything on docs.phala.com directly from the terminal, with zero setup. No MCP registration, no links to paste: if the agent has thephalaCLI, it has the current docs.phala docs search <query>phala docs read <page>docs.phala.comURLphala docs tree [path] -L <depth>phala docs grep <pattern> [path]--filesfor paths only)phala docs feedback <page> <msg>All subcommands support
--json, require no authentication, exit non-zero with actionable hints on failure, and human output cross-links the sibling subcommands so an agent that discovers one discovers them all.How it works
The hosted docs MCP server (
https://docs.phala.com/mcp) is a stateless streamable-HTTP endpoint, so each call is a single JSON-RPC POST — implemented in a ~180-line wire-format client (cli/src/lib/docs-mcp.ts) with no MCP SDK dependency.searchuses the server'ssearch_phalatoolread/tree/grepusequery_docs_filesystem_phala, a virtual filesystem over the published docs that acceptscat/tree/rgcommandsreadnormalizes URLs → paths, strips anchors, and auto-resolvespage→page.mdx→page/index.mdxPHALA_DOCS_MCP_URLoverrides the endpointBecause everything is served live, docs updates are visible to the CLI immediately — bundled
phala helptopics stay version-pinned to the installed CLI, whilephala docsis the freshness channel.Testing
cli/src/lib/docs-mcp.test.ts)tsc --noEmitclean--files), JSON mode, and error paths (missing page, bad tree path) all verifiedFollow-ups (not in this PR)
phala docsin the top-level--helpepilogue and in error remediation hintsskills/phala-cli/SKILL.mdso agents learn about it up front🤖 Generated with Claude Code