Skip to content

Commit

Permalink
Merge branch 'main' into feature/754-processable-output-bullet-proof
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille authored Nov 21, 2024
2 parents 025c492 + d706ab4 commit 9ca75db
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 41 deletions.
77 changes: 40 additions & 37 deletions cli/src/main/java/com/devonfw/tools/ide/context/GitUrlSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,51 @@ public enum GitUrlSyntax {
/**
* The DEFAULT Git URL syntax
*/
DEFAULT(""),
DEFAULT("") {
@Override
public GitUrl format(GitUrl gitUrl) {
return gitUrl; // No conversion for DEFAULT
}
},
/**
* The SSH Git URL syntax (e.g., [email protected]:user/repo.git).
*/
SSH("git@"),
SSH("git@") {
@Override
public GitUrl format(GitUrl gitUrl) {
String url = gitUrl.url();
if (isDomainWithNoConversion(url.toLowerCase())) {
return gitUrl;
}
if (url.startsWith(HTTPS.prefix)) {
int index = url.indexOf("/", HTTPS.prefix.length());
if (index > 0) {
url = SSH.prefix + url.substring(HTTPS.prefix.length(), index) + ":" + url.substring(index + 1);
}
}
return new GitUrl(url, gitUrl.branch());
}
},

/**
* The HTTPS Git URL syntax (e.g., https://github.com/user/repo.git).
*/
HTTPS("https://");
HTTPS("https://") {
@Override
public GitUrl format(GitUrl gitUrl) {
String url = gitUrl.url();
if (isDomainWithNoConversion(url.toLowerCase())) {
return gitUrl;
}
if (url.startsWith(SSH.prefix)) {
int index = url.indexOf(":");
if (index > 0) {
url = HTTPS.prefix + url.substring(SSH.prefix.length(), index) + "/" + url.substring(index + 1);
}
}
return new GitUrl(url, gitUrl.branch());
}
};

private final String prefix;

Expand All @@ -40,41 +75,9 @@ public enum GitUrlSyntax {
* @return the formatted {@link GitUrl} according to this syntax.
* @throws IllegalArgumentException if the protocol is not supported.
*/
public GitUrl format(GitUrl gitUrl) {
if (this == DEFAULT) {
return gitUrl;
}
String url = gitUrl.url();

// Prevent conversion for domains in the no-conversion list
if (isDomainWithNoConversion(url.toLowerCase())) {
return gitUrl;
}

switch (this) {
case SSH -> {
if (url.startsWith(HTTPS.prefix)) {
int index = url.indexOf("/", HTTPS.prefix.length());
if (index > 0) {
url = SSH.prefix + url.substring(HTTPS.prefix.length(), index) + ":" + url.substring(index + 1);
}
}
}
case HTTPS -> {
if (url.startsWith(SSH.prefix)) {
int index = url.indexOf(":");
if (index > 0) {
url = HTTPS.prefix + url.substring(SSH.prefix.length(), index) + "/" + url.substring(index + 1);
}
}
}
default -> throw new IllegalArgumentException("Unsupported protocol: " + this);
}

return new GitUrl(url, gitUrl.branch());
}
public abstract GitUrl format(GitUrl gitUrl);

private boolean isDomainWithNoConversion(String url) {
private static boolean isDomainWithNoConversion(String url) {

for (String domain : DOMAINS_WITH_NO_CONVERSION) {
// Check if it's an HTTPS URL for the domain
Expand Down
33 changes: 33 additions & 0 deletions documentation/coding-assistant.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:toc:
toc::[]

= Coding Assistant
The Coding Assistant is an AI-powered tool that helps you write and edit code more efficiently.
It offers features like code suggestions, autocompletion, and error detection, improving productivity and reducing mistakes.
It can be easily integrated into your development environment for smarter coding support.

== Continue
Continue is a leading open-source AI code assistant.
It comes with features like https://docs.continue.dev/chat/how-to-use-it[Chat], https://docs.continue.dev/autocomplete/how-to-use-it[Autocomplete], https://docs.continue.dev/edit/how-to-use-it[Edit] and https://docs.continue.dev/actions/how-to-use-it[Actions].
Currently, the plugin is available for Intellij and VSCode.
With IDEasy, we aim to keep the configuration process simple and provide the option to pre-configure the code assistant via https://github.com/devonfw/ide-settings[ide-settings]

A possible pre-configuration file can be found here: https://github.com/devonfw/ide-settings/workspace/update/.continuerc.json[.continuerc.json]

The config is set so that your model runs via `vllm`.
The only action you have to take is to override the `apiBase` key with your server url.
Telemetry is also disabled by default.
There is a variety of different configurations that can be done with `continue` plugin.
You can find the latest information and documentation here: https://docs.continue.dev/
```
{
"models": [
{
"title": "My vLLM OpenAI-compatible server",
"apiBase": "http://localhost:8000/v1"
}
],

"allowAnonymousTelemetry": false
}
```
10 changes: 6 additions & 4 deletions documentation/setup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Create a central folder `projects` folder (on Windows use `C:\projects` or `D:\p
Inside this folder, create a sub-folder named `_ide` and extract the contents of the downloaded archive (`ide-cli-*.tar.gz`) to this new folder (e.g. `C:\projects\_ide`).
Run the command `setup` in this folder (on windows double clicking on `setup.bat`).
To get started read the link:usage.adoc[usage].
After the installation process, you can create a new project by typing: `ide create <project>`, replace `<project>` with your project name.
Switch to the project folder e.g. `cd <project>` and install or configure tools for your project as needed.

NOTE: We are planning to create a installer that will guide users through the installation process but this is not yet released.

Expand All @@ -45,10 +47,10 @@ Instead you just create a folder and extract the xref:download[downloaded] archi
All the other softwares remain locally in your IDEasy folder.
However, there are the following excuses (what is reverted by `ide uninstall`):

* The `ide` command is copied to your home directory (`~/.ide/scripts/ide`)
* The `ide` alias is added to your shell config (`~/.bashrc` and `~/.zshrc`, search for `alias ide="source ~/.ide/scripts/ide"`).
* On Windows the `ide.bat` command is copied to your home directory (`%USERPROFILE%\.ide\scripts\ide.bat`)
* On Windows this `%USERPROFILE%\.ide\scripts` directory is added to the `PATH` of your user.
* The `ide` alias is added to your shell config (`~/.bashrc` and `~/.zshrc`, search for: `alias ide=`).
* The `completion` is added to your shell config (`~/.bashrc` and `~/.zshrc`, search for: `_ide/completion`).
* The `IDE_ROOT` environment variable is added to your environment variables.
* The `$IDE_ROOT/_ide/bin` folder is added to your `PATH` environment variable.
* `IDEasy` will download all third party software to your `~/Downloads/ide` folder to reduce redundant storage.
You have to delete this folder manually as we do not want to be responsible for data-loss in case users manually put files here.

Expand Down

0 comments on commit 9ca75db

Please sign in to comment.