diff --git a/README.md b/README.md index 35f7fb9..bba5462 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ curl -s -X POST 'https://context4ai.org/sourcegraph/api/search?repo=context4ai/c Or use the CLI and the agent skill: ```sh -npm i -g https://github.com/context4ai/sourcegraph/releases/latest/download/sourcegraph-cli.tgz +npm i -g @c4a/sourcegraph sourcegraph search -r context4ai/sourcegraph -g '*.go' 'func main' npx skills add context4ai/sourcegraph --skill sourcegraph # Claude Code, Codex, Cursor and others ``` diff --git a/README.zh-CN.md b/README.zh-CN.md index b3ad76a..4a1b4fd 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -66,7 +66,7 @@ curl -s -X POST 'https://context4ai.org/sourcegraph/api/search?repo=context4ai/c 也可以使用 CLI 和 Agent Skill: ```sh -npm i -g https://github.com/context4ai/sourcegraph/releases/latest/download/sourcegraph-cli.tgz +npm i -g @c4a/sourcegraph sourcegraph search -r context4ai/sourcegraph -g '*.go' 'func main' npx skills add context4ai/sourcegraph --skill sourcegraph # Claude Code、Codex、Cursor 等 ``` diff --git a/cli/README.md b/cli/README.md index b0526e2..e7c2934 100644 --- a/cli/README.md +++ b/cli/README.md @@ -3,7 +3,7 @@ Command-line client for [Sourcegraph](https://github.com/context4ai/sourcegraph): search and read code at a pinned commit, register and manage repositories, and change personal and site settings. It uses the site's HTTP API, so it can do what the website does, with the same permissions. ```bash -npm i -g https://github.com/context4ai/sourcegraph/releases/latest/download/sourcegraph-cli.tgz +npm i -g @c4a/sourcegraph sourcegraph login # approve in the browser; a 90-day token is saved sourcegraph search -r context4ai/sourcegraph -g '*.go' 'func main' ``` diff --git a/config/deployment.json b/config/deployment.json index 0129abb..5d770ba 100644 --- a/config/deployment.json +++ b/config/deployment.json @@ -54,9 +54,7 @@ "site_aliases": {}, "topology_diagram": false, "cli": { - "package": "@c4a/sourcegraph", - "registry": "https://registry.npmjs.org", - "install": "npm i -g https://github.com/context4ai/sourcegraph/releases/latest/download/sourcegraph-cli.tgz" + "package": "@c4a/sourcegraph" }, "skill": { "name": "sourcegraph", diff --git a/docs/interfaces.md b/docs/interfaces.md index b0619c1..f378304 100644 --- a/docs/interfaces.md +++ b/docs/interfaces.md @@ -142,7 +142,7 @@ Manual preparation is paced per repository across the website, HTTP and MCP. A r ### Command-line client `sourcegraph` -`npm i -g https://github.com/context4ai/sourcegraph/releases/latest/download/sourcegraph-cli.tgz` installs `sourcegraph`, a fuller client that also registers and manages repositories, personal tokens and site settings. `sourcegraph login` signs in through the website and stores a 90-day personal token; `sourcegraph --help` lists every command. See [cli/README.md](../cli/README.md). The agent skill in [skills/sourcegraph](../skills/sourcegraph/SKILL.md) teaches agents to use MCP or this CLI: `npx skills add context4ai/sourcegraph --skill sourcegraph`. +`npm i -g @c4a/sourcegraph` installs `sourcegraph`, a fuller client that also registers and manages repositories, personal tokens and site settings. `sourcegraph login` signs in through the website and stores a 90-day personal token; `sourcegraph --help` lists every command. See [cli/README.md](../cli/README.md). The agent skill in [skills/sourcegraph](../skills/sourcegraph/SKILL.md) teaches agents to use MCP or this CLI: `npx skills add context4ai/sourcegraph --skill sourcegraph`. ## Remote reads diff --git a/skills/sourcegraph/SKILL.md b/skills/sourcegraph/SKILL.md index 72bc7b1..c1227fd 100644 --- a/skills/sourcegraph/SKILL.md +++ b/skills/sourcegraph/SKILL.md @@ -18,7 +18,7 @@ Self-hosted deployments work the same way: use their address with --url or in th ## Choose MCP or CLI 1. If `tools/list` shows `search`, `read` and friends from `sourcegraph`, use MCP. With a token in the MCP configuration the server also offers `whoami`, `repository_register`, `repository_settings`, `repository_jobs`, `personal_settings`, `site_settings` and `site_admin`; without a token (or with `?tools=read`) only query tools exist. Never ask the user for a token inside the conversation: it belongs in the client configuration. -2. Otherwise use the CLI (Node 18+): `npm i -g https://github.com/context4ai/sourcegraph/releases/latest/download/sourcegraph-cli.tgz`. `sourcegraph --help` and `sourcegraph --help` list everything. Pick the site with `--site default` or `--url
`; Context4AI is the default. +2. Otherwise use the CLI (Node 18+): `npm i -g @c4a/sourcegraph`. `sourcegraph --help` and `sourcegraph --help` list everything. Pick the site with `--site default` or `--url
`; Context4AI is the default. 3. Sign-in: `sourcegraph login` prints a link and a code; the user approves it in the browser and the CLI stores a 90-day personal token for that site. In non-interactive environments use `SOURCEGRAPH_API_TOKEN`. Public repositories need no sign-in for queries. A token acts as its owner: it reads what the owner can read, manages repositories the owner manages, and administers the site only while the owner is a site administrator. A token can be narrowed to repositories with given tags and/or to non-public repositories (its visibility scope); repositories outside it answer `REPOSITORY_OUTSIDE_TOKEN_SCOPE`. Without a token, a registered repository that is not public answers `REPOSITORY_SIGN_IN_REQUIRED` and names managers who can make it public: tell the user to sign in (`sourcegraph login`) or configure a token, not that the repository is unregistered. Never print or log tokens.