Skip to content

Commit a5b9b93

Browse files
[UX]: Add dstack project CLI to configure, list, and switch between projects (#2653)
1 parent fd2adf6 commit a5b9b93

14 files changed

Lines changed: 245 additions & 16 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ To point the CLI to the `dstack` server, configure it
107107
with the server address, user token, and project name:
108108

109109
```shell
110-
$ dstack config \
110+
$ dstack project add \
111+
--name main \
111112
--url http://127.0.0.1:3000 \
112-
--project main \
113113
--token bbae0f28-d3dd-4820-bf61-8f4bb40815da
114114

115115
Configuration is updated at ~/.dstack/config.yml

docker/server/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ with the server address, user token, and project name:
2929

3030
```shell
3131
$ pip install dstack
32-
$ dstack config --url http://127.0.0.1:3000 \
33-
--project main \
32+
$ dstack project add --name main \
33+
--url http://127.0.0.1:3000 \
3434
--token bbae0f28-d3dd-4820-bf61-8f4bb40815da
3535

3636
Configuration is updated at ~/.dstack/config.yml

docs/blog/posts/dstack-sky.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ set up with `dstack Sky`.
4040
<div class="termy">
4141

4242
```shell
43-
$ dstack config --url https://sky.dstack.ai \
44-
--project my-awesome-project \
43+
$ dstack project add --name my-awesome-project \
44+
--url https://sky.dstack.ai \
4545
--token ca1ee60b-7b3f-8943-9a25-6974c50efa75
4646
```
4747

docs/docs/concepts/projects.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ and when using the CLI or API.
4949

5050
### Setting up the CLI
5151

52-
To use the CLI with a specific project, run the `dstack config` command with the server address, user token, and project name.
52+
You can configure multiple projects on the client and set the default project using the [`dstack project`](../reference/cli/dstack/project.md) CLI command.
5353

5454
You can find the command on the project’s settings page:
5555

56-
<img src="https://dstack.ai/static-assets/static-assets/images/dstack-projects-project-cli.png" width="750px" />
56+
<img src="https://dstack.ai/static-assets/static-assets/images/dstack-projects-project-cli-v2.png" width="750px" />
5757

5858
??? info "API"
5959
In addition to the UI, managing projects, users, and user permissions can also be done via the [REST API](../reference/api/rest/index.md).

docs/docs/guides/dstack-sky.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Then, install the CLI on your machine and use the copied command.
1515

1616
```shell
1717
$ pip install dstack
18-
$ dstack config --url https://sky.dstack.ai \
19-
--project peterschmidt85 \
18+
$ dstack project add --name peterschmidt85 \
19+
--url https://sky.dstack.ai \
2020
--token bbae0f28-d3dd-4820-bf61-8f4bb40815da
2121

2222
Configuration is updated at ~/.dstack/config.yml

docs/docs/installation/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ with the server address, user token, and project name:
127127
<div class="termy">
128128

129129
```shell
130-
$ dstack config \
130+
$ dstack project add \
131+
--name main \
131132
--url http://127.0.0.1:3000 \
132-
--project main \
133133
--token bbae0f28-d3dd-4820-bf61-8f4bb40815da
134134

135135
Configuration is updated at ~/.dstack/config.yml

docs/docs/reference/cli/dstack/config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# dstack config
22

3+
!!! info "Deprecated"
4+
The `dstack config` is deprecated. Use [`dstack project`](project.md) instead.
5+
36
Both the CLI and API need to be configured with the server address, user token, and project name
47
via `~/.dstack/config.yml`.
58

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# dstack project
2+
3+
Before the CLI can be used, it must be configured with a [project](../../../concepts/projects.md), including a project name, server address, and user token. You can configure multiple projects using the `dstack project` CLI command. The configuration is stored in `~/.dstack/config.yml`.
4+
5+
> The `dstack server` command automatically creates the default `main` project and adds its configuration in `~/.dstack/config.yml`.
6+
7+
The `dstack project set-default` command can be used to switch between multiple projects.
8+
9+
## dstack project add
10+
11+
This command adds a new project configuration.
12+
13+
<div class="termy">
14+
15+
```shell
16+
$ dstack project add --help
17+
#GENERATE#
18+
```
19+
20+
</div>
21+
22+
You can find the command on the project’s settings page:
23+
24+
<img src="https://dstack.ai/static-assets/static-assets/images/dstack-projects-project-cli-v2.png" width="750px" />
25+
26+
## dstack project list
27+
28+
This command lists the projects configured on the client.
29+
30+
<div class="termy">
31+
32+
```shell
33+
$ dstack project list --help
34+
#GENERATE#
35+
```
36+
37+
</div>
38+
39+
## dstack project set-default
40+
41+
This command sets the given project as default.
42+
43+
<div class="termy">
44+
45+
```shell
46+
$ dstack project set-default --help
47+
#GENERATE#
48+
```
49+
50+
</div>
51+
52+
## dstack project delete
53+
54+
This command deletes the given project configuration.
55+
56+
<div class="termy">
57+
58+
```shell
59+
$ dstack project delete --help
60+
#GENERATE#
61+
```
62+
63+
</div>

frontend/src/layouts/AppLayout/TutorialPanel/constants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const CONFIGURE_CLI_TUTORIAL: TutorialPanelProps.Tutorial = {
9292
title: 'Configure the CLI',
9393
steps: [
9494
{
95-
title: 'Run the dstack config command',
95+
title: 'Run the dstack project add command',
9696
content: 'Run this command on your local machine to configure the dstack CLI.',
9797
hotspotId: HotspotIds.CONFIGURE_CLI_COMMAND,
9898
},

frontend/src/pages/Project/hooks/useConfigProjectCliComand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type Args = {
99
export const useConfigProjectCliCommand = ({ projectName }: Args) => {
1010
const currentUserToken = useAppSelector(selectAuthToken);
1111

12-
const cliCommand = `dstack config --url ${location.origin} --project ${projectName} --token ${currentUserToken}`;
12+
const cliCommand = `dstack project add --name ${projectName} --url ${location.origin} --token ${currentUserToken}`;
1313

1414
const copyCliCommand = () => {
1515
copyToClipboard(cliCommand);

0 commit comments

Comments
 (0)