Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 等
```
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```
Expand Down
4 changes: 1 addition & 3 deletions config/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion skills/sourcegraph/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <command> --help` list everything. Pick the site with `--site default` or `--url <address>`; Context4AI is the default.
2. Otherwise use the CLI (Node 18+): `npm i -g @c4a/sourcegraph`. `sourcegraph --help` and `sourcegraph <command> --help` list everything. Pick the site with `--site default` or `--url <address>`; 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.
Expand Down