Skip to content

Commit e0d1973

Browse files
authored
docs: Add documentation for the src prompts command (#1155)
Add documentation for the `src prompts` command and its subcommands. Added documentation for the new src prompts commands sourcegraph/src-cli#1168 ## Pull Request approval You will need to get your PR approved by at least one member of the Sourcegraph team. For reviews of docs formatting, styles, and component usage, please tag the docs team via the #docs Slack channel.
1 parent a629da7 commit e0d1973

File tree

15 files changed

+638
-0
lines changed

15 files changed

+638
-0
lines changed

docs/cli/references/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Most commands require that the user first [authenticate](quickstart#connect-to-s
1515
* [`login`](references/login)
1616
* [`lsif`](references/lsif)
1717
* [`orgs`](references/orgs)
18+
* [`prompts`](references/prompts)
1819
* [`repos`](references/repos)
1920
* [`scout`](references/scout)
2021
* [`search`](references/search)

docs/cli/references/prompts.mdx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# src prompts
2+
3+
<p className="subtitle">`src prompts` is a tool that manages prompt library prompts and tags in a Sourcegraph instance.</p>
4+
5+
## Usage
6+
7+
```
8+
'src prompts' is a tool that manages prompt library prompts and tags in a Sourcegraph instance.
9+
10+
Usage:
11+
12+
src prompts command [command options]
13+
14+
The commands are:
15+
16+
list lists prompts
17+
get get a prompt by ID
18+
create create a prompt
19+
update update a prompt
20+
delete delete a prompt
21+
export export prompts to a JSON file
22+
import import prompts from a JSON file
23+
tags manage prompt tags (use "src prompts tags [command] -h" for more info)
24+
25+
Use "src prompts [command] -h" for more information about a command.
26+
```
27+
28+
## Sub-commands
29+
30+
* [list](prompts/list)
31+
* [get](prompts/get)
32+
* [create](prompts/create)
33+
* [update](prompts/update)
34+
* [delete](prompts/delete)
35+
* [export](prompts/export)
36+
* [import](prompts/import)
37+
* [tags](prompts/tags)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# src prompts create
2+
3+
Create a new prompt in your Sourcegraph instance.
4+
5+
## Usage
6+
7+
```bash
8+
src prompts create [flags]
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
# Create a basic prompt (uses current user as owner)
15+
src prompts create \
16+
-name="go-error-handling" \
17+
-description="Best practices for Go error handling" \
18+
-content="Write a Go function that properly handles errors..."
19+
20+
# Create a prompt with tags
21+
src prompts create \
22+
-name="python-optimization" \
23+
-description="Python performance optimization tips" \
24+
-content="Optimize this Python code for better performance..." \
25+
-tags="UHJvbXB0VGFnOjE=,UHJvbXB0VGFnOjI="
26+
27+
# Create a draft prompt
28+
src prompts create \
29+
-name="draft-prompt" \
30+
-description="Work in progress prompt" \
31+
-content="This prompt is still being developed..." \
32+
-draft
33+
34+
# Create a recommended prompt with auto-submit
35+
src prompts create \
36+
-name="recommended-prompt" \
37+
-description="A recommended prompt for common use" \
38+
-content="This is a recommended prompt..." \
39+
-recommended \
40+
-auto-submit
41+
42+
# Create a secret prompt for INSERT mode
43+
src prompts create \
44+
-name="secret-insert-prompt" \
45+
-description="Secret prompt for code insertion" \
46+
-content="Insert code here..." \
47+
-visibility="SECRET" \
48+
-mode="INSERT"
49+
50+
# Create a prompt with explicit owner (optional)
51+
src prompts create \
52+
-name="team-shared-prompt" \
53+
-description="A prompt shared with a specific owner" \
54+
-content="This prompt has an explicit owner..." \
55+
-owner="VXNlcjox"
56+
```
57+
58+
## Flags
59+
60+
| Flag | Description |
61+
|------|-------------|
62+
| `-name` | The prompt name (required) |
63+
| `-description` | Description of the prompt (required) |
64+
| `-content` | The prompt template text content (required) |
65+
| `-owner` | The ID of the owner (user or organization) (optional, defaults to current user) |
66+
| `-tags` | Comma-separated list of tag IDs |
67+
| `-draft` | Whether the prompt is a draft (default: false) |
68+
| `-visibility` | Visibility of the prompt: PUBLIC or SECRET (default: "PUBLIC") |
69+
| `-auto-submit` | Whether the prompt should be automatically executed in one click (default: false) |
70+
| `-mode` | Mode to execute prompt: CHAT, EDIT, or INSERT (default: "CHAT") |
71+
| `-recommended` | Whether the prompt is recommended (default: false) |
72+
73+
### API flags
74+
75+
| Flag | Description |
76+
|------|-------------|
77+
| `-dump-requests` | Log GraphQL requests and responses to stdout |
78+
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) |
79+
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains |
80+
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing |
81+
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default: true) |
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# src prompts delete
2+
3+
Delete a prompt from your Sourcegraph instance.
4+
5+
## Usage
6+
7+
```bash
8+
src prompts delete <prompt-id>
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
# Delete a prompt by ID
15+
src prompts delete UHJvbXB0OjE=
16+
17+
# The command will confirm successful deletion
18+
src prompts delete UHJvbXB0OjE=
19+
# Output: Prompt deleted successfully.
20+
```
21+
22+
## Flags
23+
24+
### API flags
25+
26+
| Flag | Description |
27+
|------|-------------|
28+
| `-dump-requests` | Log GraphQL requests and responses to stdout |
29+
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) |
30+
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains |
31+
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing |
32+
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default: true) |
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# src prompts export
2+
3+
Export prompts to a JSON file.
4+
5+
## Usage
6+
7+
```bash
8+
src prompts export [flags]
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
# Export all prompts to stdout
15+
src prompts export
16+
17+
# Export all prompts to a file
18+
src prompts export -o prompts-backup.json
19+
20+
# Export with pretty formatting
21+
src prompts export -o prompts-backup.json -format=pretty
22+
23+
# Export prompts with specific tags
24+
src prompts export -o go-prompts.json -tags="go,golang"
25+
26+
# Export prompts with multiple tag filters
27+
src prompts export -o filtered-prompts.json -tags="python,data-science,ml"
28+
```
29+
30+
## Flags
31+
32+
| Flag | Description |
33+
|------|-------------|
34+
| `-o` | Output file path (defaults to stdout if not specified) |
35+
| `-tags` | Comma-separated list of tag names to filter by |
36+
| `-format` | JSON format: 'pretty' or 'compact' (default: 'compact') |
37+
38+
### API flags
39+
40+
| Flag | Description |
41+
|------|-------------|
42+
| `-dump-requests` | Log GraphQL requests and responses to stdout |
43+
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) |
44+
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains |
45+
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing |
46+
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default: true) |

docs/cli/references/prompts/get.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# src prompts get
2+
3+
Get details about a specific prompt by ID.
4+
5+
## Usage
6+
7+
```bash
8+
src prompts get <prompt-id>
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
# Get prompt by ID
15+
src prompts get UHJvbXB0OjE=
16+
```
17+
18+
## Flags
19+
20+
### API flags
21+
22+
| Flag | Description |
23+
|------|-------------|
24+
| `-dump-requests` | Log GraphQL requests and responses to stdout |
25+
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) |
26+
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains |
27+
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing |
28+
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default: true) |
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# src prompts import
2+
3+
Import prompts from a JSON file.
4+
5+
## Usage
6+
7+
```bash
8+
src prompts import [flags]
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
# Import prompts from a file (uses current user as owner)
15+
src prompts import -i prompts.json
16+
17+
# Import prompts with a specific owner
18+
src prompts import -i prompts.json -owner="VXNlcjox"
19+
20+
# Perform a dry run without creating any prompts
21+
src prompts import -i prompts.json -dry-run
22+
23+
# Skip existing prompts with the same name
24+
src prompts import -i prompts.json -skip-existing
25+
26+
# Combine flags for validation and skipping
27+
src prompts import -i prompts.json -dry-run -skip-existing
28+
```
29+
30+
## Flags
31+
32+
| Flag | Description |
33+
|------|-------------|
34+
| `-i` | Input file path (required) |
35+
| `-owner` | The ID of the owner for all imported prompts (defaults to current user) |
36+
| `-dry-run` | Validate without importing |
37+
| `-skip-existing` | Skip prompts that already exist (based on name) |
38+
39+
### API flags
40+
41+
| Flag | Description |
42+
|------|-------------|
43+
| `-dump-requests` | Log GraphQL requests and responses to stdout |
44+
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) |
45+
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains |
46+
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing |
47+
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default: true) |

docs/cli/references/prompts/list.mdx

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# src prompts list
2+
3+
List all prompts in your Sourcegraph instance.
4+
5+
## Usage
6+
7+
```bash
8+
src prompts list [flags]
9+
```
10+
11+
## Examples
12+
13+
```bash
14+
# List all prompts
15+
src prompts list
16+
17+
# Search prompts by name, description, or content
18+
src prompts list -query="error handling"
19+
20+
# Filter prompts by tag IDs
21+
src prompts list -tags="UHJvbXB0VGFnOjE=,UHJvbXB0VGFnOjI="
22+
23+
# List prompts for a specific owner
24+
src prompts list -owner="VXNlcjox"
25+
26+
# List only recommended prompts
27+
src prompts list -recommended-only
28+
29+
# List built-in prompts only
30+
src prompts list -builtin-only
31+
32+
# Include built-in prompts with user prompts
33+
src prompts list -include-builtin
34+
35+
# Exclude draft prompts
36+
src prompts list -include-drafts=false
37+
38+
# List prompts owned by viewer or their organizations
39+
src prompts list -affiliated
40+
41+
# Paginate through results
42+
src prompts list -limit=10 -after="cursor"
43+
44+
# Select specific columns to display
45+
src prompts list -c id,name,description,visibility
46+
47+
# Output results as JSON
48+
src prompts list -json
49+
50+
# Complex filtering example
51+
src prompts list -query="Go" -recommended-only -include-drafts=false -json
52+
```
53+
54+
## Flags
55+
56+
| Flag | Description |
57+
|------|-------------|
58+
| `-query` | Search prompts by name, description, or content |
59+
| `-owner` | Filter by prompt owner (a namespace, either a user or organization) |
60+
| `-tags` | Comma-separated list of tag IDs to filter by |
61+
| `-affiliated` | Filter to only prompts owned by the viewer or viewer's organizations |
62+
| `-recommended-only` | Whether to include only recommended prompts |
63+
| `-builtin-only` | Whether to include only builtin prompts |
64+
| `-include-builtin` | Whether to include builtin prompts |
65+
| `-include-drafts` | Whether to include draft prompts (default: true) |
66+
| `-limit` | Maximum number of prompts to list (default: 100) |
67+
| `-after` | Cursor for pagination (from previous page's endCursor) |
68+
| `-c` | Comma-separated list of columns to display. Available: id,name,description,draft,visibility,mode,tags (default: "id,name,visibility,tags") |
69+
| `-json` | Output results as JSON for programmatic access |
70+
71+
### API flags
72+
73+
| Flag | Description |
74+
|------|-------------|
75+
| `-dump-requests` | Log GraphQL requests and responses to stdout |
76+
| `-get-curl` | Print the curl command for executing this query and exit (WARNING: includes printing your access token!) |
77+
| `-insecure-skip-verify` | Skip validation of TLS certificates against trusted chains |
78+
| `-trace` | Log the trace ID for requests. See https://docs.sourcegraph.com/admin/observability/tracing |
79+
| `-user-agent-telemetry` | Include the operating system and architecture in the User-Agent sent with requests to Sourcegraph (default: true) |

0 commit comments

Comments
 (0)