mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 01:35:36 +00:00
feat(web): idx website and user docs (Astro Starlight)
Landing page plus docs for install, quickstart, config, the stocks and ownership CLI, output and exit codes, the MCP server and per-agent setup, agent usage, and an agent-led install page (agents/install.md) that a coding agent follows from a one-line prompt. - Every docs page is also served as Markdown at <path>.md; llms.txt and llms-full.txt come from starlight-llms-txt; a SKILL.md for skill-based harnesses is under /skills/idx/. - The CLI reference and MCP tools pages are generated from idx --help and the tools golden; a new web-generated flake check fails when they drift. - nix develop .#web provides bun; Cloudflare Pages builds web/ on pushes. - Package homepage metadata points at https://idx.rasyidanaf.com. - .cloudflare/ (the cf CLI's account cache) is git-ignored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e231061820
commit
e6805474f5
37 changed files with 3629 additions and 4 deletions
58
web/scripts/gen-cli-reference.sh
Executable file
58
web/scripts/gen-cli-reference.sh
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env bash
|
||||
# Writes the CLI reference page from `idx --help` output, walking every
|
||||
# subcommand. `nix flake check` runs it against the packaged binary and fails
|
||||
# when the committed page is out of date.
|
||||
#
|
||||
# web/scripts/gen-cli-reference.sh <idx-binary> > web/src/content/docs/cli/reference.md
|
||||
set -euo pipefail
|
||||
|
||||
idx=${1:?usage: gen-cli-reference.sh <idx-binary>}
|
||||
|
||||
subcommands() {
|
||||
"$idx" "$@" --help | awk '
|
||||
/^Commands:/ { in_cmds = 1; next }
|
||||
in_cmds && /^[^ ]/ { exit }
|
||||
in_cmds && /^ [a-z]/ { if ($1 != "help") print $1 }
|
||||
'
|
||||
}
|
||||
|
||||
section() {
|
||||
local depth=$1
|
||||
shift
|
||||
local hashes
|
||||
hashes=$(printf '#%.0s' $(seq 1 "$depth"))
|
||||
# shellcheck disable=SC2016 # backticks are Markdown, not command substitution
|
||||
printf '%s `idx %s`\n\n```text\n' "$hashes" "$*"
|
||||
"$idx" "$@" --help
|
||||
printf '```\n\n'
|
||||
local sub
|
||||
for sub in $(subcommands "$@"); do
|
||||
section $((depth + 1)) "$@" "$sub"
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
cat <<'EOF'
|
||||
---
|
||||
title: Command reference
|
||||
description: Every idx command and flag, generated from idx --help.
|
||||
---
|
||||
|
||||
<!-- Generated by web/scripts/gen-cli-reference.sh; do not edit by hand. -->
|
||||
|
||||
This page is generated from `idx --help`, so it always matches the released
|
||||
CLI. For explanations and examples, see the [stocks](/cli/stocks/) and
|
||||
[ownership](/cli/ownership/) guides.
|
||||
|
||||
## `idx`
|
||||
|
||||
```text
|
||||
EOF
|
||||
"$idx" --help
|
||||
printf '```\n\n'
|
||||
for group in $(subcommands); do
|
||||
section 2 "$group"
|
||||
done
|
||||
}
|
||||
|
||||
main | sed -e 's/[[:space:]]*$//' -e '${/^$/d}'
|
||||
49
web/scripts/gen-mcp-tools.sh
Executable file
49
web/scripts/gen-mcp-tools.sh
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env bash
|
||||
# Writes the MCP tools page from idx-mcp's tools golden
|
||||
# (crates/idx-mcp/tests/golden/tools.json). `nix flake check` fails when the
|
||||
# committed page is out of date.
|
||||
#
|
||||
# web/scripts/gen-mcp-tools.sh crates/idx-mcp/tests/golden/tools.json > web/src/content/docs/mcp/tools.md
|
||||
set -euo pipefail
|
||||
|
||||
tools=${1:?usage: gen-mcp-tools.sh <tools.json>}
|
||||
|
||||
cat <<'EOF'
|
||||
---
|
||||
title: Tools
|
||||
description: Every idx-mcp tool and its inputs, generated from the server's tool list.
|
||||
---
|
||||
|
||||
<!-- Generated by web/scripts/gen-mcp-tools.sh; do not edit by hand. -->
|
||||
|
||||
idx-mcp serves these tools. `ownership_sync` is listed only when the server
|
||||
starts with `--allow-sync`. Results that come from a live provider are wrapped
|
||||
as `{data, source, fetched_at, stale}`; failures return `{error, code,
|
||||
message}` with `isError` set.
|
||||
|
||||
EOF
|
||||
|
||||
jq -r '
|
||||
def typ($defs):
|
||||
if .["$ref"] then ($defs[.["$ref"] | sub("^#/\\$defs/"; "")] | .enum | map("`" + . + "`") | join(" / "))
|
||||
elif .enum then (.enum | map("`" + tostring + "`") | join(" / "))
|
||||
elif (.type | type) == "array" then
|
||||
(.type | map(select(. != "null")) | join(" | "))
|
||||
+ (if .items then " of " + (.items | typ($defs)) else "" end)
|
||||
elif .type == "array" and .items then "array of " + (.items | typ($defs))
|
||||
else (.type // "any") end;
|
||||
[.[]
|
||||
| .inputSchema as $s
|
||||
| ($s["$defs"] // {}) as $defs
|
||||
| ($s.required // []) as $req
|
||||
| "## `\(.name)`\n\n\(.description)\n\n"
|
||||
+ (if ($s.properties // {}) == {} then "No inputs.\n"
|
||||
else
|
||||
"| Input | Type | Required | Description |\n| --- | --- | --- | --- |\n"
|
||||
+ ([$s.properties | to_entries[]
|
||||
| .key as $k
|
||||
| "| `\($k)` | \(.value | typ($defs)) | \(if ($req | index($k)) then "yes" else "no" end) | \((.value.description // "") | gsub("\\|"; "\\|") | gsub("\n"; " ")) |"]
|
||||
| join("\n")) + "\n"
|
||||
end)]
|
||||
| join("\n")
|
||||
' "$tools" | sed '${/^$/d}'
|
||||
Loading…
Add table
Add a link
Reference in a new issue