Skip to content

Commit ae1fc6e

Browse files
authored
feat: add docs generation from the cobra commands so that further LLM (#116)
models swallow the CLI shape
1 parent c43ea4d commit ae1fc6e

87 files changed

Lines changed: 3590 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,22 @@ jobs:
6868

6969
- if: failure()
7070
run: echo "::error::Check failed, please run 'go mod tidy' and commit the changes."
71+
72+
docs-check:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
77+
with:
78+
persist-credentials: false
79+
80+
- name: Set up tools
81+
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
82+
with:
83+
version: 2026.3.8
84+
85+
- name: Check docs are up to date
86+
run: make docs-check
87+
88+
- if: failure()
89+
run: echo "::error::Check failed, please run 'make docs' and commit the changes."

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo unknown)
22

3-
.PHONY: build debug debug-run test lint format clean bootstrap
3+
.PHONY: build debug debug-run test lint format clean bootstrap docs docs-check
44

55
build:
66
CGO_ENABLED=0 go build -ldflags "-X main.version=$(VERSION)" -o build/qcloud ./cmd/qcloud
@@ -32,3 +32,10 @@ bootstrap:
3232
{ echo "mise is not installed. Install it from https://mise.jdx.dev/installing-mise.html"; exit 1; }
3333
mise install
3434

35+
docs:
36+
go run ./cmd/docgen ./docs/reference
37+
38+
docs-check: docs
39+
@git diff --exit-code docs/reference/ || \
40+
(echo "docs/reference is out of date — run 'make docs' and commit the result" && exit 1)
41+

cmd/docgen/main.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package main
2+
3+
import (
4+
"log"
5+
"os"
6+
7+
"github.com/spf13/cobra/doc"
8+
9+
"github.com/qdrant/qcloud-cli/internal/cli"
10+
"github.com/qdrant/qcloud-cli/internal/state"
11+
)
12+
13+
func main() {
14+
outDir := "./docs/reference"
15+
if len(os.Args) > 1 {
16+
outDir = os.Args[1]
17+
}
18+
19+
if err := os.MkdirAll(outDir, 0755); err != nil {
20+
log.Fatalf("create output dir: %v", err)
21+
}
22+
23+
s := state.New("dev")
24+
root := cli.NewRootCommand(s)
25+
root.DisableAutoGenTag = true
26+
27+
if err := doc.GenMarkdownTree(root, outDir); err != nil {
28+
log.Fatalf("generate docs: %v", err)
29+
}
30+
}

docs/reference/qcloud.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## qcloud
2+
3+
Qdrant Cloud CLI
4+
5+
### Synopsis
6+
7+
The command-line interface for Qdrant Cloud.
8+
9+
Get started:
10+
qcloud context set default --api-key <KEY> --account-id <ID>
11+
qcloud cluster list
12+
13+
Documentation: https://github.com/qdrant/qcloud-cli
14+
15+
### Options
16+
17+
```
18+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
19+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
20+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
21+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
22+
--debug Enable debug logging to stderr
23+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
24+
-h, --help help for qcloud
25+
--json Output as JSON
26+
```
27+
28+
### SEE ALSO
29+
30+
* [qcloud account](qcloud_account.md) - Manage Qdrant Cloud accounts
31+
* [qcloud backup](qcloud_backup.md) - Manage Qdrant Cloud backups
32+
* [qcloud cloud-provider](qcloud_cloud-provider.md) - Manage cloud providers
33+
* [qcloud cloud-region](qcloud_cloud-region.md) - Manage cloud regions
34+
* [qcloud cluster](qcloud_cluster.md) - Manage Qdrant Cloud clusters
35+
* [qcloud context](qcloud_context.md) - Manage named configuration contexts
36+
* [qcloud hybrid](qcloud_hybrid.md) - Manage hybrid cloud environments
37+
* [qcloud iam](qcloud_iam.md) - Manage IAM resources in Qdrant Cloud
38+
* [qcloud package](qcloud_package.md) - Manage packages
39+
* [qcloud self-upgrade](qcloud_self-upgrade.md) - Upgrade qcloud to the latest version
40+
* [qcloud version](qcloud_version.md) - Print the qcloud CLI version
41+

docs/reference/qcloud_account.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## qcloud account
2+
3+
Manage Qdrant Cloud accounts
4+
5+
### Synopsis
6+
7+
Manage Qdrant Cloud accounts and their members.
8+
9+
Use these commands to list, inspect, and update accounts that the current
10+
management key has access to. Account member commands show who belongs to the
11+
current account and whether they are the owner.
12+
13+
### Options
14+
15+
```
16+
-h, --help help for account
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
23+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
24+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
25+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
26+
--debug Enable debug logging to stderr
27+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
28+
--json Output as JSON
29+
```
30+
31+
### SEE ALSO
32+
33+
* [qcloud](qcloud.md) - Qdrant Cloud CLI
34+
* [qcloud account describe](qcloud_account_describe.md) - Describe an account
35+
* [qcloud account list](qcloud_account_list.md) - List accounts
36+
* [qcloud account member](qcloud_account_member.md) - Manage account members
37+
* [qcloud account update](qcloud_account_update.md) - Update an account
38+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## qcloud account describe
2+
3+
Describe an account
4+
5+
### Synopsis
6+
7+
Describe an account by its ID.
8+
9+
If no account ID is provided, the current account (from --account-id, the
10+
active context, or the QDRANT_CLOUD_ACCOUNT_ID environment variable) is used.
11+
12+
```
13+
qcloud account describe [account-id] [flags]
14+
```
15+
16+
### Examples
17+
18+
```
19+
# Describe the current account
20+
qcloud account describe
21+
22+
# Describe a specific account
23+
qcloud account describe a1b2c3d4-e5f6-7890-abcd-ef1234567890
24+
25+
# Output as JSON
26+
qcloud account describe --json
27+
```
28+
29+
### Options
30+
31+
```
32+
-h, --help help for describe
33+
```
34+
35+
### Options inherited from parent commands
36+
37+
```
38+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
39+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
40+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
41+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
42+
--debug Enable debug logging to stderr
43+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
44+
--json Output as JSON
45+
```
46+
47+
### SEE ALSO
48+
49+
* [qcloud account](qcloud_account.md) - Manage Qdrant Cloud accounts
50+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## qcloud account list
2+
3+
List accounts
4+
5+
### Synopsis
6+
7+
List all accounts associated with the authenticated management key.
8+
9+
Returns every account the current API key has access to. No account ID is
10+
required because the server resolves accounts from the caller's credentials.
11+
12+
```
13+
qcloud account list [flags]
14+
```
15+
16+
### Examples
17+
18+
```
19+
# List all accessible accounts
20+
qcloud account list
21+
22+
# Output as JSON
23+
qcloud account list --json
24+
```
25+
26+
### Options
27+
28+
```
29+
-h, --help help for list
30+
--no-headers Do not print column headers
31+
```
32+
33+
### Options inherited from parent commands
34+
35+
```
36+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
37+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
38+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
39+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
40+
--debug Enable debug logging to stderr
41+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
42+
--json Output as JSON
43+
```
44+
45+
### SEE ALSO
46+
47+
* [qcloud account](qcloud_account.md) - Manage Qdrant Cloud accounts
48+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## qcloud account member
2+
3+
Manage account members
4+
5+
### Synopsis
6+
7+
Manage members of the current Qdrant Cloud account.
8+
9+
Members are users who have been added to the account. Each member has an
10+
associated user record and an ownership flag indicating whether they are the
11+
account owner.
12+
13+
### Options
14+
15+
```
16+
-h, --help help for member
17+
```
18+
19+
### Options inherited from parent commands
20+
21+
```
22+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
23+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
24+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
25+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
26+
--debug Enable debug logging to stderr
27+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
28+
--json Output as JSON
29+
```
30+
31+
### SEE ALSO
32+
33+
* [qcloud account](qcloud_account.md) - Manage Qdrant Cloud accounts
34+
* [qcloud account member describe](qcloud_account_member_describe.md) - Describe an account member
35+
* [qcloud account member list](qcloud_account_member_list.md) - List account members
36+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## qcloud account member describe
2+
3+
Describe an account member
4+
5+
### Synopsis
6+
7+
Describe a member of the current account by their user ID.
8+
9+
Shows the member's user details and whether they are the account owner.
10+
11+
```
12+
qcloud account member describe <user-id> [flags]
13+
```
14+
15+
### Examples
16+
17+
```
18+
# Describe a member
19+
qcloud account member describe a1b2c3d4-e5f6-7890-abcd-ef1234567890
20+
21+
# Output as JSON
22+
qcloud account member describe a1b2c3d4-e5f6-7890-abcd-ef1234567890 --json
23+
```
24+
25+
### Options
26+
27+
```
28+
-h, --help help for describe
29+
```
30+
31+
### Options inherited from parent commands
32+
33+
```
34+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
35+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
36+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
37+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
38+
--debug Enable debug logging to stderr
39+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
40+
--json Output as JSON
41+
```
42+
43+
### SEE ALSO
44+
45+
* [qcloud account member](qcloud_account_member.md) - Manage account members
46+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## qcloud account member list
2+
3+
List account members
4+
5+
### Synopsis
6+
7+
List all members of the current account.
8+
9+
Each member has an associated user record and an ownership flag. Use
10+
"qcloud iam user list" to see users with their status, or this command to
11+
see who is in the account and who owns it.
12+
13+
```
14+
qcloud account member list [flags]
15+
```
16+
17+
### Examples
18+
19+
```
20+
# List all members
21+
qcloud account member list
22+
23+
# Output as JSON
24+
qcloud account member list --json
25+
```
26+
27+
### Options
28+
29+
```
30+
-h, --help help for list
31+
--no-headers Do not print column headers
32+
```
33+
34+
### Options inherited from parent commands
35+
36+
```
37+
--account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID)
38+
--api-key string Management API Key (env: QDRANT_CLOUD_API_KEY)
39+
-c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml)
40+
--context string Override the active context (env: QDRANT_CLOUD_CONTEXT)
41+
--debug Enable debug logging to stderr
42+
--endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443)
43+
--json Output as JSON
44+
```
45+
46+
### SEE ALSO
47+
48+
* [qcloud account member](qcloud_account_member.md) - Manage account members
49+

0 commit comments

Comments
 (0)