Skip to content

Commit bf4b35e

Browse files
authored
Merge pull request #19 from tidbcloud/help_message_refine#4
readme and help simplified; preview behavior explained.
2 parents 1fd4329 + 0973347 commit bf4b35e

3 files changed

Lines changed: 67 additions & 82 deletions

File tree

‎README.md‎

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
# tdc
22

3-
`tdc` is the command-line interface for TiDB Cloud Filesystem and TiDB Cloud Starter.
3+
tdc ([TiDB Cloud](https://tidbcloud.com) CLI) is a unified tool to manage your TiDB Cloud Filesystem (FS) and Starter services.
44

5-
> tdc is currently in Preview. Its features and command-line interface might change without prior notice.
5+
- TiDB Cloud Filesystem is a serverless distributed file system designed specifically for AI coding agent workloads.
6+
- TiDB Cloud Starter provides serverless distributed database clusters that are fully compatible with MySQL.
67

7-
- TiDB Cloud Filesystem is a distributed file system designed specifically for AI coding agent workloads, with zero infrastructure.
8-
- TiDB Cloud Starter provides distributed database clusters that are fully compatible with MySQL, with zero infrastructure.
8+
> `tdc` is currently in preview. Subcommands labeled as preview are subject to change without prior notice.
99
10-
## Your Agent's Toolbelt
10+
## 3-Command Superpower for Your Agent
1111

12-
### Always-on, zero infrastructure file system for sandboxes — The 3-Command Superpower
12+
### Always-On File System for Sandboxes — Zero Infrastructure Required
1313

14-
An agent can persist state between sessions, share files across sandboxes, snapshot its workspace before attempting a risky operation, and roll back on failure — all through a CLI with POSIX compatibility.
14+
With `tdc`, an agent can persist state between sessions, share files across sandboxes, snapshot its workspace before attempting a risky operation, and roll back on failure — all through a CLI with POSIX compatibility.
1515

16-
1. Create a filesystem resource and get the returning token (one-time, out of the sandbox)
16+
1. Create a file system and obtain the file system token (performed once, outside the sandbox).
1717

1818
```shell
1919
export TDC_FS_TOKEN="$(tdc fs create-file-system --file-system-name agent-workspace --region <REGION_CODE> --wait --query fs_token --output text)"
2020
```
2121

22-
2. Mount the filesystem and use just like any regular POSIX-compliant filesystem (inside the sandbox environment)
22+
2. Mount the filesystem to a local path and use it as a normal POSIX-compliant filesystem (performed within the sandbox)
2323

2424
```shell
2525
export TDC_FS_TOKEN="<FS_TOKEN>"
26-
tdc fs mount-file-system --file-system-name agent-workspace --mount-path /path_to_workspace --region <REGION_CODE>
27-
echo "Hello Sandbox Workspace!" >> /path_to_workspace/hello.txt
26+
tdc fs mount-file-system --file-system-name agent-workspace --mount-path /path-to-workspace --region <REGION_CODE>
27+
echo "Hello Sandbox Workspace!" >> /path-to-workspace/hello.txt
2828
```
2929

30-
3. Unmount to safely release the workspace before handing off to another sandbox (inside the sandbox environment)
30+
3. Unmount the file system to release the workspace before passing it to another sandbox (performed within the sandbox).
3131

3232
```shell
33-
tdc fs unmount-file-system --mount-path /path_to_workspace --region <REGION_CODE>
33+
tdc fs unmount-file-system --mount-path /path-to-workspace --region <REGION_CODE>
3434
```
3535

36-
### Always-on, zero infrastructure MySQL — The 3-Command Superpower
36+
### Always-On MySQL — Zero Infrastructure Required
3737

38-
An agent can go from zero to live HTAP SQL (Hybrid Transaction / Analytical Processing) in three commands:
38+
With `tdc`, an agent can go from zero to live HTAP SQL (Hybrid Transaction / Analytical Processing) in three commands:
3939

4040
1. Provision a serverless MySQL-compatible cluster, wait until it is active, and capture its ID
4141

@@ -93,28 +93,31 @@ Add `$HOME\.tdc\bin` to your user `PATH` to keep tdc available in new PowerShell
9393

9494
### Configure
9595

96-
Configure `tdc` with a TiDB Cloud Public Key and Private Key from the [TiDB Cloud](https://tidbcloud.com/org-settings/api-keys) console. Supported region codes are `aws-us-east-1`, `aws-us-west-2`, `aws-eu-central-1`, `aws-ap-northeast-1`, `aws-ap-southeast-1`, and `ali-ap-southeast-1`.
96+
- Authentication: a TiDB Cloud Public Key and a Private Key from the [TiDB Cloud API Keys](https://tidbcloud.com/org-settings/api-keys) console.
97+
- Default region: one of aws-us-east-1, aws-us-west-2, aws-eu-central-1, aws-ap-northeast-1, aws-ap-southeast-1, or ali-ap-southeast-1.
98+
- Regions support TiDB Cloud Filesystem: aws-us-east-1, aws-ap-southeast-1.
99+
- Regions support TiDB Cloud Starter: aws-us-east-1, aws-us-west-2, aws-eu-central-1, aws-ap-northeast-1, aws-ap-southeast-1, or ali-ap-southeast-1.
100+
101+
Set up a default profile with one command:
97102

98103
```shell
99104
tdc configure --non-interactive --region-code <TDC_REGION_CODE> --tdc-public-key <TDC_PUBLIC_KEY> --tdc-private-key <TDC_PRIVATE_KEY>
100105
```
101106

102-
Configure verifies the API key by listing all accessible projects, requires exactly one project with `type = "tidbx_virtual"`, and stores its ID as the profile's default `project_id` in `~/.tdc/config`. API credentials remain in `~/.tdc/credentials`. Configuration fails without changing the profile when project discovery fails.
107+
Alternatively, set up a default profile interactively by running the command below. You will be prompted to enter your TiDB Cloud Public Key, Private Key, and the default region:
103108

104-
```toml
105-
[default]
106-
region_code = "aws-us-east-1"
107-
project_id = "1372813089454645969"
109+
```shell
110+
tdc configure
108111
```
109112

110-
### TiDB Cloud Filesystem
113+
`tdc configure` stores non-sensitive settings in `~/.tdc/config` and API credentials to `~/.tdc/credentials`.
111114

112-
Supported regions: `aws-us-east-1` and `aws-ap-southeast-1`.
115+
### TiDB Cloud Filesystem
113116

114117
```shell
115118
mkdir ~/my-workspace
116119
tdc fs create-file-system --file-system-name my-workspace --wait
117-
tdc fs mount-file-system --mount-path ~/my-workspace
120+
tdc fs mount-file-system --file-system-name my-workspace --mount-path ~/my-workspace
118121
```
119122

120123
Automatic mounting uses FUSE on Linux and WebDAV on macOS and Windows. macOS users can install macFUSE and explicitly add `--driver fuse` for the full FUSE experience.
@@ -133,45 +136,27 @@ tdc fs describe-file-system --file-system-name scratch
133136
export TDC_FS_TOKEN="$(tdc fs create-file-system --file-system-name agent-workspace --wait --query fs_token --output text)"
134137
```
135138

136-
Without `--wait`, file system creation returns after Drive9 accepts provisioning. With the flag, tdc waits up to 10 minutes until the file system root is readable through the public Drive9 data-plane CLI. A timeout or interruption leaves the file system and its locally stored credentials intact.
137-
138139
An agent sandbox can then use that existing file system without running `tdc configure` or providing TiDB Cloud API keys:
139140

140141
```shell
141142
export TDC_FS_TOKEN="<FS_TOKEN>"
142143
tdc fs mount-file-system --file-system-name agent-workspace --mount-path /path_to_workspace --region aws-us-east-1
143144
```
144145

146+
> **Preview Note:** Creating a new file system automatically provisions and manages a TiDB Cloud Starter database cluster (name prefix `tidbcloud-fs-`) in your TiDB Cloud organization. This is temporary behavior; in future releases, this backend database cluster will no longer be displayed or count against your TiDB Cloud Starter slot limits.
147+
145148
### TiDB Cloud Starter
146149

147150
```shell
148151
tdc db create-db-cluster --db-cluster-name my-distributed-mysql --db-cluster-type starter --wait
149152
```
150153

151-
Cluster creation uses the configured `project_id` by default. Use optional `--project-id <project-id>` to create in another accessible project. An explicit empty `--project-id` is rejected instead of falling back to the profile.
152-
153-
Without `--wait`, cluster creation returns as soon as TiDB Cloud accepts the asynchronous create request. With the flag, tdc waits up to 12 minutes and returns the final `ACTIVE` cluster. A timeout or interruption leaves the created cluster intact and reports its ID for inspection.
154-
155-
Branch creation and cluster deletion have equivalent explicit wait modes:
156-
157-
```shell
158-
tdc db create-db-cluster-branch --db-cluster-id <CLUSTER_ID> --db-cluster-branch-name development --wait
159-
tdc db delete-db-cluster --db-cluster-id <CLUSTER_ID> --wait
160-
```
161-
162-
Branch waiting lasts up to 5 minutes. Cluster deletion waiting lasts up to 12 minutes and succeeds when the API reports `DELETED` or the deleted cluster is no longer accessible.
163-
164-
### Organization Projects
165-
166-
```shell
167-
tdc organization list-projects
168-
```
169-
170-
Each project includes a `type`: `tidbx` identifies a regular project and `tidbx_virtual` identifies a virtual project.
171-
172-
## Commands
154+
## Get Help
173155

174-
Running `tdc` without a command returns a usage error and a compact two-level command synopsis. Run `tdc help`, `tdc <command> help`, or `tdc <command> <subcommand> help` for the full command list, flags, and examples. Help displays flag value types in angle brackets and marks required flags with `(required)`.
156+
- `tdc`
157+
- `tdc help`
158+
- `tdc <command> help`
159+
- `tdc <command> <subcommand> help`
175160

176161
<details>
177162
<summary>All commands</summary>
@@ -267,9 +252,9 @@ tdc update --target-version v0.1.1
267252

268253
## Documentation
269254

270-
- [English Preview documentation](docs/pingcap-docs/docs/ai/tdc/tdc-overview.md)
255+
- [Preview Documentation](docs/pingcap-docs/docs/ai/tdc/tdc-overview.md)
271256

272-
## Build from source
257+
## Build From Source
273258

274259
Requirements:
275260

‎internal/cli/commands.go‎

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ func addFSSelectorFlags(commands []*cobra.Command, excluded ...string) {
903903
continue
904904
}
905905
if command.Flags().Lookup("file-system-name") == nil {
906-
command.Flags().String("file-system-name", "", "tdc fs resource name; defaults to the profile default or only configured resource")
906+
command.Flags().String("file-system-name", "", "The name of the file system.")
907907
}
908908
}
909909
}
@@ -918,7 +918,7 @@ func addFSAuthFlags(commands []*cobra.Command, excluded ...string) {
918918
continue
919919
}
920920
if command.Flags().Lookup("fs-token") == nil {
921-
command.Flags().String("fs-token", "", "tdc fs owner token; prefer TDC_FS_TOKEN for automation")
921+
command.Flags().String("fs-token", "", "File system user token. Default: value taken from the TDC_FS_TOKEN environment variable if not provided.")
922922
}
923923
}
924924
}
@@ -981,9 +981,9 @@ func newFSCreateFileSystemCommand(info version.Info) *cobra.Command {
981981
})
982982
},
983983
}, info)
984-
cmd.Flags().String("file-system-name", "", "File system name.")
985-
cmd.Flags().Bool("set-default", false, "make the created file system the profile default")
986-
cmd.Flags().Bool("wait", false, "wait until the created file system data plane is ready")
984+
cmd.Flags().String("file-system-name", "", "The name of the file system.")
985+
cmd.Flags().Bool("set-default", false, "Make the created file system the profile default.")
986+
cmd.Flags().Bool("wait", false, "Wait until the created file system is active.")
987987
markUsageRequired(cmd, "file-system-name")
988988
return cmd
989989
}
@@ -1170,19 +1170,19 @@ func newFSCopyFileCommand(info version.Info) *cobra.Command {
11701170
},
11711171
}, info)
11721172
cmd.Flags().String("from-local", "", "The local source path.")
1173-
cmd.Flags().String("from-remote", "", "The TiDB Cloud file system source path.")
1174-
cmd.Flags().String("to-local", "", "The local target path.")
1175-
cmd.Flags().String("to-remote", "", "The TiDB Cloud file system target path.")
1176-
cmd.Flags().Bool("from-stdin", false, "Read from stdin and upload to --to-remote.")
1173+
cmd.Flags().String("from-remote", "", "The source path in the TiDB Cloud file system.")
1174+
cmd.Flags().String("to-local", "", "The local destination path.")
1175+
cmd.Flags().String("to-remote", "", "The destination path in the TiDB Cloud file system.")
1176+
cmd.Flags().Bool("from-stdin", false, "Read from stdin and write to --to-remote.")
11771177
cmd.Flags().Bool("to-stdout", false, "Write --from-remote to stdout.")
1178-
cmd.Flags().Bool("overwrite", false, "Replace an existing target.")
1178+
cmd.Flags().Bool("overwrite", false, "Replace an existing destination file.")
11791179
cmd.Flags().Bool("create-parents", false, "Create missing local parent directories when copying from a TiDB Cloud file system.")
1180-
cmd.Flags().Bool("append", false, "Append a local file to a remote file in TiDB Cloud file system.")
1181-
cmd.Flags().Bool("recursive", false, "Copy directory contents recursively.")
1182-
cmd.Flags().Bool("resume", false, "Resume an active local-to-remote upload or a partial remote-to-local download.")
1183-
cmd.Flags().String("layer-id", "", "Write the copy target into a file system layer instead of the base file system.")
1184-
cmd.Flags().StringArray("tag", nil, "Create tag(s) key=value for uploads; repeatable.")
1185-
cmd.Flags().String("description", "", "The file description for local or stdin uploads.")
1180+
cmd.Flags().Bool("append", false, "Append a local file content to a file in the TiDB Cloudfile system.")
1181+
cmd.Flags().Bool("recursive", false, "Copy directory structure recursively.")
1182+
cmd.Flags().Bool("resume", false, "Resume an active copy operation.")
1183+
cmd.Flags().String("layer-id", "", "Write the copied file content into a file system layer instead of the base file system.")
1184+
cmd.Flags().StringArray("tag", nil, "Create tag(s) key=value for --to-remote operation; repeatable.")
1185+
cmd.Flags().String("description", "", "The file description for --to-remote operation.")
11861186
return cmd
11871187
}
11881188

@@ -1386,8 +1386,8 @@ func newFSCreateDirectoryCommand(info version.Info) *cobra.Command {
13861386
})
13871387
},
13881388
}, info)
1389-
cmd.Flags().String("path", "", "tdc fs directory path")
1390-
cmd.Flags().String("mode", "", "directory mode as an octal value such as 0755")
1389+
cmd.Flags().String("path", "", "The file system path of the directory to create.")
1390+
cmd.Flags().String("mode", "", "The directory mode as an octal value such as 0755.")
13911391
markUsageRequired(cmd, "path")
13921392
return cmd
13931393
}
@@ -1473,8 +1473,8 @@ func newFSHardlinkFileCommand(info version.Info) *cobra.Command {
14731473
return service.HardlinkFile(ctx.cmd.Context(), tdcfs.HardlinkFileOptions{Profile: profile, Source: source, Link: link})
14741474
},
14751475
}, info)
1476-
cmd.Flags().String("source-path", "", "existing tdc fs source file path")
1477-
cmd.Flags().String("link-path", "", "tdc fs path for the created hard link")
1476+
cmd.Flags().String("source-path", "", "The existing file path in the TiDB Cloud file system.")
1477+
cmd.Flags().String("link-path", "", "The file path for the hard link being created in the TiDB Cloud file system.")
14781478
markUsageRequired(cmd, "source-path", "link-path")
14791479
return cmd
14801480
}
@@ -1559,7 +1559,7 @@ func newFSFindFilesCommand(info version.Info) *cobra.Command {
15591559
func newFSCreateLayerCommand(info version.Info) *cobra.Command {
15601560
cmd := newControlPlaneCommand(controlPlaneCommandSpec{
15611561
Use: "create-layer",
1562-
Short: "Create a file system layer.",
1562+
Short: "Create a file system layer. (preview)",
15631563
Mutation: mutatingCommand,
15641564
Permission: authz.FSFileWrite,
15651565
Run: func(ctx commandContext) (any, error) {
@@ -1597,8 +1597,8 @@ func newFSCreateLayerCommand(info version.Info) *cobra.Command {
15971597
return service.DryRunLayerMutation(ctx.cmd.Context(), ctx.CommandPath(), "create_layer", "POST", "/v1/layers", body, profile, authz.FSFileWrite)
15981598
},
15991599
}, info)
1600-
cmd.Flags().String("layer-id", "", "optional stable layer id")
1601-
cmd.Flags().String("base-root-path", "", "base tdc fs root path for the layer")
1600+
cmd.Flags().String("layer-id", "", "Stable layer ID")
1601+
cmd.Flags().String("base-root-path", "", "Base TiDB Cloud file system root path for the layer.")
16021602
cmd.Flags().String("layer-name", "", "human-readable layer name")
16031603
cmd.Flags().StringArray("tag", nil, "layer tag key=value; repeatable")
16041604
cmd.Flags().String("durability-mode", "", "layer durability mode, for example restore-safe")
@@ -1610,7 +1610,7 @@ func newFSCreateLayerCommand(info version.Info) *cobra.Command {
16101610
func newFSListLayersCommand(info version.Info) *cobra.Command {
16111611
return newControlPlaneCommand(controlPlaneCommandSpec{
16121612
Use: "list-layers",
1613-
Short: "List file system layers for a specific file system.",
1613+
Short: "List file system layers for a specific file system. (preview)",
16141614
Mutation: readOnlyCommand,
16151615
Permission: authz.FSFileRead,
16161616
Run: func(ctx commandContext) (any, error) {
@@ -1626,7 +1626,7 @@ func newFSListLayersCommand(info version.Info) *cobra.Command {
16261626
func newFSDescribeLayerCommand(info version.Info) *cobra.Command {
16271627
cmd := newControlPlaneCommand(controlPlaneCommandSpec{
16281628
Use: "describe-layer",
1629-
Short: "Describe a specified file system layer.",
1629+
Short: "Describe a specified file system layer. (preview)",
16301630
Mutation: readOnlyCommand,
16311631
Permission: authz.FSFileRead,
16321632
Run: func(ctx commandContext) (any, error) {
@@ -1641,15 +1641,15 @@ func newFSDescribeLayerCommand(info version.Info) *cobra.Command {
16411641
return service.DescribeLayer(ctx.cmd.Context(), tdcfs.DescribeLayerOptions{Profile: profile, LayerID: layerID})
16421642
},
16431643
}, info)
1644-
cmd.Flags().String("layer-id", "", "tdc fs layer id")
1644+
cmd.Flags().String("layer-id", "", "The ID of the specified file system layer.")
16451645
markUsageRequired(cmd, "layer-id")
16461646
return cmd
16471647
}
16481648

16491649
func newFSDiffLayerCommand(info version.Info) *cobra.Command {
16501650
cmd := newControlPlaneCommand(controlPlaneCommandSpec{
16511651
Use: "diff-layer",
1652-
Short: "Show changed entries in a file system layer.",
1652+
Short: "Show changed entries in a file system layer. (preview)",
16531653
Mutation: readOnlyCommand,
16541654
Permission: authz.FSFileRead,
16551655
Run: func(ctx commandContext) (any, error) {
@@ -1673,7 +1673,7 @@ func newFSDiffLayerCommand(info version.Info) *cobra.Command {
16731673
func newFSCreateLayerCheckpointCommand(info version.Info) *cobra.Command {
16741674
cmd := newControlPlaneCommand(controlPlaneCommandSpec{
16751675
Use: "create-layer-checkpoint",
1676-
Short: "Create a layer checkpoint.",
1676+
Short: "Create a layer checkpoint. (preview)",
16771677
Mutation: mutatingCommand,
16781678
Permission: authz.FSFileWrite,
16791679
Run: func(ctx commandContext) (any, error) {
@@ -1746,7 +1746,7 @@ func newFSRollbackLayerCommand(info version.Info) *cobra.Command {
17461746
func newFSCommitLayerCommand(info version.Info) *cobra.Command {
17471747
cmd := newControlPlaneCommand(controlPlaneCommandSpec{
17481748
Use: "commit-layer",
1749-
Short: "Commit a layer into the base file system.",
1749+
Short: "Commit a layer into the base file system. (preview)",
17501750
Mutation: mutatingCommand,
17511751
Permission: authz.FSFileWrite,
17521752
Run: func(ctx commandContext) (any, error) {
@@ -1883,7 +1883,7 @@ func newFSMountFileSystemCommand(info version.Info) *cobra.Command {
18831883
return service.DryRunMountFileSystem(ctx.cmd.Context(), ctx.CommandPath(), opts)
18841884
},
18851885
}, info)
1886-
cmd.Flags().String("file-system-name", "", "tdc fs resource name; defaults to the profile default or only configured resource")
1886+
cmd.Flags().String("file-system-name", "", "The name of the file system. Default: the name of the default file system in the profile.")
18871887
cmd.Flags().String("mount-path", "", "local mount path")
18881888
cmd.Flags().String("remote-path", "/", "tdc fs remote root path to expose")
18891889
cmd.Flags().String("driver", "auto", "mount driver: auto, fuse, or webdav")

‎internal/cli/root.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ func newControlPlaneCommand(spec controlPlaneCommandSpec, info version.Info) *co
399399
},
400400
}, info)
401401
if spec.Mutation == mutatingCommand {
402-
cmd.Flags().Bool("dry-run", false, "validate the request without creating, updating, or deleting remote resources")
402+
cmd.Flags().Bool("dry-run", false, "Validate the request without doing the actual changes.")
403403
}
404404
return cmd
405405
}

0 commit comments

Comments
 (0)