Skip to content

Commit a1c8dc3

Browse files
JAORMXdanbarr
andauthored
Add initial documentation on workspaces (#49)
* Add initial documentation on workspaces This does not yet document the UI, but it does document the workspace prompt CLI. Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com> * Language and style updates, add rename command * Fix code block languages Missed a few - normalize all to plain * CLI updates * Fix plaintext code blocks language * Add workspaces UI docs and update descriptions * Add GitHub-style theme switch support * Add workspaces to changelog --------- Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com> Co-authored-by: Dan Barr <dan@stacklok.com>
1 parent 8de2856 commit a1c8dc3

File tree

7 files changed

+266
-7
lines changed

7 files changed

+266
-7
lines changed

docs/about/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Major features and changes are noted here. To review all updates, see the
1313

1414
Related: [Upgrade CodeGate](../how-to/install.md#upgrade-codegate)
1515

16+
- **Workspaces** - 22 Jan, 2025\
17+
Now available in CodeGate v0.1.12, workspaces help you organize and customize
18+
your AI-assisted development. Learn more in
19+
[Workspaces](../features/workspaces.mdx).
20+
1621
- **Aider support** - 13 Jan, 2025\
1722
CodeGate version 0.1.6 adds support for [Aider](https://aider.chat/), an LLM
1823
pair programmer in your terminal. See the

docs/features/security-reviews.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ more secure recommendations and code suggestions.
2525

2626
### Example prompts
2727

28-
```plain
28+
```text
2929
Review the following Python files for potential security vulnerabilities:
3030
3131
@app.py
3232
@main.py
3333
```
3434

35-
```plain
35+
```text
3636
Analyze the AuthUser function in @login.py for any security issues
3737
```

docs/features/workspaces.mdx

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
---
2+
title: Workspaces
3+
description: Organize and customize your project environments
4+
sidebar_position: 40
5+
---
6+
7+
import useBaseUrl from '@docusaurus/useBaseUrl';
8+
import ThemedImage from '@theme/ThemedImage';
9+
10+
## Overview
11+
12+
_Workspaces_ in CodeGate allow you to organize and customize your interactions
13+
with large language models (LLMs). Each workspace is a distinct environment with
14+
its own configuration and history, enabling personalized settings and efficient
15+
management of your projects or tasks.
16+
17+
Examples might include workspaces for different projects you're working on, or
18+
for specific tasks like code reviews or generating documentation. You can add
19+
custom instructions to each workspace to customize its behavior suitable to the
20+
task at hand.
21+
22+
## Key features
23+
24+
Workspaces offer several key features:
25+
26+
- **Custom instructions**: Customize your interactions with LLMs by augmenting
27+
your AI assistant's system prompt, enabling tailored responses and behaviors
28+
for different types of tasks.
29+
30+
- **Prompt and alert history**: Your LLM interactions (prompt history) and
31+
CodeGate security detections (alert history) are recorded in the active
32+
workspace, allowing you to track and review past interactions.
33+
34+
- **Isolation**: Configurations and data in one workspace do not affect others,
35+
providing clarity when reviewing your AI-assisted coding history and precision
36+
in tailoring your custom instructions.
37+
38+
:::tip Recommendations
39+
40+
- Use workspaces to separate different projects or objectives, with customized
41+
instructions to optimize your work in each focus area.
42+
- Switch your active workspace as you move between projects or tasks. This helps
43+
you maintain your prompt and alert history for each project.
44+
- Regularly review and update your custom instructions to align with the
45+
evolving needs of your projects.
46+
47+
:::
48+
49+
## Working with workspaces
50+
51+
You can view and manage your workspaces from the
52+
[CodeGate dashboard](../how-to/dashboard.md)
53+
([http://localhost:9090](http://localhost:9090)) or using commands in your AI
54+
assistant's chat interface.
55+
56+
:::info Default workspace
57+
58+
CodeGate ships with a default workspace named `default`. This workspace cannot
59+
be renamed, archived, or deleted.
60+
61+
:::
62+
63+
Only one workspace is active at any one time, and all AI assistant interactions
64+
occur within that workspace.
65+
66+
You can perform several actions on workspaces:
67+
68+
- **Activate**: Activate a workspace for use. Only one workspace can be active
69+
at a time.
70+
- **Add**: Create a new workspace.
71+
- **Rename**: Change the name of a workspace.
72+
- **Custom instructions**: Add custom instructions to augment your AI
73+
assistant's system prompt.
74+
- **Archive**: Mark a workspace as archived without permanently deleting it. The
75+
workspace is hidden from the available workspaces list, but can be restored
76+
later. This is useful when you are not actively working on a project but may
77+
want to come back to it in the future.
78+
- **Delete**: Permanently delete an archived workspace (CLI only).
79+
80+
## Manage workspaces using the dashboard
81+
82+
### Select the active workspace
83+
84+
The currently active workspace is displayed at the top of the CodeGate dashboard
85+
interface. You can change the active workspace by expanding the workspace
86+
drop-down menu. Select the workspace you want to activate. You can also search
87+
by name to quickly find the desired workspace.
88+
89+
<ThemedImage
90+
alt='The workspace drop-down menu in the CodeGate dashboard'
91+
sources={{
92+
light: useBaseUrl('/img/features/workspace-menu-light.webp'),
93+
dark: useBaseUrl('/img/quickstart/workspace-menu-dark.webp'),
94+
}}
95+
title='Workspace menu'
96+
width={'800px'}
97+
/>
98+
_The workspace menu in the CodeGate dashboard_
99+
100+
### Manage workspaces
101+
102+
To manage all your workspaces, select **Manage Workspaces** in the workspace
103+
menu.
104+
105+
Click **Create Workspace** to add a new workspace. Workspace names can contain
106+
alphanumeric characters, hyphens (`-`), and underscores (`_`). Names are
107+
converted to lowercase, and must be unique.
108+
109+
In the workspace list, click the **Settings** button next to a workspace to open
110+
the workspace settings screen. From here you can rename the workspace, set the
111+
custom prompt instructions, or archive the workspace. Archived workspaces can be
112+
restored from the Manage Workspaces screen, or permanently deleted
113+
[using the CLI](#delete).
114+
115+
## Manage workspaces using the chat CLI
116+
117+
You can manage workspaces using `codegate workspace` commands sent through your
118+
AI assistant's chat interface. To see all available commands, run:
119+
120+
```text
121+
codegate workspace -h
122+
```
123+
124+
### Create a workspace \{#add}
125+
126+
To create a new workspace:
127+
128+
```text
129+
codegate workspace add WORKSPACE_NAME
130+
```
131+
132+
Replace `WORKSPACE_NAME` with a name for the new workspace. Names can only
133+
contain alphanumeric characters, hyphens (`-`), and underscores (`_`).
134+
135+
### List workspaces \{#list}
136+
137+
Get a list of all non-archived workspaces:
138+
139+
```text
140+
codegate workspace list
141+
```
142+
143+
The currently active workspace is indicated as **(active)** in the list.
144+
145+
### Activate a workspace \{#activate}
146+
147+
Switch between workspaces using the `activate` command. The active workspace is
148+
the current environment for commands and configuration.
149+
150+
```text
151+
codegate workspace activate WORKSPACE_NAME
152+
```
153+
154+
Replace `WORKSPACE_NAME` with the name of the workspace to activate.
155+
156+
### Customize the system prompt \{#custom-instructions}
157+
158+
To add custom instructions to your system prompt:
159+
160+
```text
161+
codegate custom-instructions [-w WORKSPACE_NAME] set SYSTEM_PROMPT
162+
```
163+
164+
Replace `SYSTEM_PROMPT` with your custom prompt text. Optionally, specify the
165+
workspace to modify with `-w WORKSPACE_NAME`. If you don't explicitly set a
166+
workspace, the currently active workspace is modified.
167+
168+
**Example**: Set a custom system prompt for the workspace named "project-alpha":
169+
170+
```text
171+
codegate custom-instructions -w project-alpha set Start each conversation with "Welcome to Project Alpha Assistant. How can I help today?"
172+
```
173+
174+
To show the current custom instructions on a workspace:
175+
176+
```text
177+
codegate custom-instructions [-w WORKSPACE_NAME] show
178+
```
179+
180+
To reset (clear) the custom instructions for a workspace:
181+
182+
```text
183+
codegate custom-instructions [-w WORKSPACE_NAME] reset
184+
```
185+
186+
### Rename a workspace \{#rename}
187+
188+
To change the name of an existing workspace:
189+
190+
```text
191+
codegate workspace rename WORKSPACE_NAME NEW_WORKSPACE_NAME
192+
```
193+
194+
Replace `WORKSPACE_NAME` with the current name of the workspace, and
195+
`NEW_WORKSPACE_NAME` with the new name to set.
196+
197+
### Archive a workspace \{#archive}
198+
199+
To archive a workspace:
200+
201+
```text
202+
codegate workspace archive WORKSPACE_NAME
203+
```
204+
205+
Replace `WORKSPACE_NAME` with the name of the workspace to archive. You cannot
206+
archive the currently active workspace. Archived workspaces can be
207+
[restored](#restore) later or [permanently deleted](#delete).
208+
209+
### List archived workspaces \{#list-archived}
210+
211+
Get a list of all archived workspaces:
212+
213+
```text
214+
codegate workspace list-archived
215+
```
216+
217+
Archived workspaces can be [restored](#restore) or
218+
[permanently deleted](#delete), but cannot be activated.
219+
220+
### Restore an archived workspace \{#restore}
221+
222+
Use the `restore` command to recover an [archived](#archive) workspace. Once
223+
restored, a workspace will appear in your available [workspace list](#list) and
224+
can be [activated](#activate).
225+
226+
```text
227+
codegate workspace restore WORKSPACE_NAME
228+
```
229+
230+
Replace `WORKSPACE_NAME` with the name of the workspace to restore.
231+
232+
### Permanently delete a workspace \{#delete}
233+
234+
The `delete-archived` command permanently deletes an archived workspace.
235+
236+
```text
237+
codegate workspace delete-archived WORKSPACE_NAME
238+
```
239+
240+
Replace `WORKSPACE_NAME` with the name of the workspace to delete.
241+
242+
:::warning
243+
244+
Deletion is permanent. Ensure that the workspace is no longer needed and can be
245+
safely removed.
246+
247+
:::

docs/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,16 @@ project. Please join us in the `#codegate` channel on the
7373

7474
Follow one of the the quickstart guides to get up and running quickly:
7575

76-
- [Quickstart guide - GitHub Copilot](quickstart-copilot.mdx) to integrate
76+
- [Quickstart guide - GitHub Copilot](./quickstart-copilot.mdx) to integrate
7777
CodeGate with GitHub Copilot and VS Code
7878
- [Quickstart guide - Continue](./quickstart-continue.mdx) to integrate CodeGate
7979
with the open source Continue extension, VS Code, and a local Ollama server
8080

81-
Review the [installation instructions](how-to/install.md).
81+
Review the [installation instructions](./how-to/install.md).
8282

8383
Learn more about CodeGate's features:
8484

85-
- [Secrets encryption](features/secrets-encryption.md)
86-
- [Dependency risk awareness](features/dependency-risk.md)
87-
- [Security reviews](features/security-reviews.md)
85+
- [Secrets encryption](./features/secrets-encryption.md)
86+
- [Dependency risk awareness](./features/dependency-risk.md)
87+
- [Security reviews](./features/security-reviews.md)
88+
- [Workspaces](./features/workspaces.mdx)

src/css/custom.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
4444
}
4545

46+
/* Enables GitHub-style light/dark mode switching without the ThemedImage component */
47+
[data-theme='light'] img[src$='#gh-dark-mode-only'],
48+
[data-theme='dark'] img[src$='#gh-light-mode-only'] {
49+
display: none;
50+
}
51+
4652
html[data-theme='dark'] {
4753
--ifm-background-color: #111827;
4854
--ifm-color-content: #d1d5db;
44.6 KB
Binary file not shown.
47.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)