Eclipse Che commands are proposing a very high level of configurability, but in certain use cases, the navigation and access to the right command is difficult and user might run into commands which will not be executed properly.
With the new capabilities around multi-machine in workspace, the commands should also target the correct machine.
Commands are tied to a context which define in which situation they might be used. Intelligent commands are providing contextualized command definition and ability for the system to know when a command is appropriate or not.
This section is providing the state of the implementation of the following specification. It also provides the list of all sub-tasks linked to it:
To run properly a command needs to be executed with the right context. Commands could be:
So the command’s context is defined by the following meta-datas:
| Projects | Machines | Dependencies |
| --- | --- | --- |
| The projects in the workspace where the command can be applied | The targets in the environment where the command will be executed | The dependencies or pre-requisites on machine which will allow the command to be properly executed |
| _mvn clean install_ can be executed only across a Maven project | _mvn clean install_ would be executed against a certain set of machine. | _mvn clean install_ would run properly, only if Maven is properly installed in the machine. |
To know its context, the command will have new settings options.
Phase1:
Phase2:
The command will have meta-datas to let the system know for which projects it can be applied.
If those meta-datas are not defined, it means the command is not project-specific and available in all project context.
For example:
In a single workspace, the user might have multiple Maven projects.
Workspace:
It is possible to define a command which will just be executed across the currently selected project (in the IDE project explorer). In this case the command definition will use the macros that we already have into the system:https://eclipse-che.readme.io/docs/commands#macros
Command definition
cd ./projects/${explorer.current.file.relpath}/ mvn clean install
There could be the possibility to define pre-check conditions in order to execute a command. This could be a script.
For example: before executing a mvn clean install command, the user will be able to configure the pre-conditions to check if the command can be executed.
When a user is configuring a commands, he is always doing it for a certain purpose, a certain goal or a certain phase of the project lifecycle. For example, he will define a command to “Build” the projects in the workspaces, he will define a command to “Run” a project, he will define a command to “Deploy” the project and so on.
Considering this notion of goal for a command, we will use them in order to better contextualize the commands:
Che will provide default set of goals, but user would have the ability to define/configure them
Command’s goal allow to configure default workspace commands and provide clearer organization and navigation into the commands.
_Toolbar_

_Palette_

_Right Click actions_

_Command Explorer - Info_

_Command Explorer - Arguments_

_Command Explorer - Arguments - Macros Catalog_

_Command Explorer - Preview URL_

_Command Explorer - Common_

Nice concept!
I miss a "Configure" goal for commands.
Most of the time new projects are created by cloning a Git repo. I find myself creating commands for configuring the projects after their creation. Things like:
Thanks for the inputs.
We have a different concept in mind for the configuration of projects called a workspace template. Think of it containing all of the configuration that must be completed for a workspace to start, but the configuration items may vary by the person starting the workspace. For example, your workspace may need ssh keys to clone a project but the keys to be provided are personal to the person who creates the workspace.
We would create a nice guided workflow that has users fill in the dependencies of a workspace template upon workspace creation. I think all of those configuration items would happen here.
Nice but I'd say there are some overall problem overthinking and overusing the Command as a first class entity
IMO it is more useful to make context dependent IDE Actions (menu item, toolbar button, context menu for project tree, context menu for particular position inside opened file etc). That would bring alot of services for developers with zero or small experience with particular technology but also experienced developers for scratching some things on very start of a project. While command related UX can duplicated this but primarily would be for more complex things to run.
We already have flexible Actions framework inside IDE and the context for displaying such an actions can be anything related to IDE Context state (project type, cursor position, content of file etc)
For Project dependent commands - I'd better make them Project Type dependent, physically it could mean storing them as attributes of Project Type, this way it is agnostic on whether the project was created from template or not.
If we need ability to assign commands to particular machine or even have some "smart" mechanism for recognizing command compatibility (mentioned as dependency), we need really strong vision about how to implement some semantic relationships between workspace/environment definition and software installed on machine runtimes. Otherwise it will be working for only limited cases (like it will work for perfectly written template but will not when something changed there).
Thanks for your inputs @gazarenkov.
I think the ability to provide contextualized IDE Actions is a good idea. I know you always had that in mind. The only issue I see with that, is how a user would be able to customize the Actions (ie: command executed behind an Action)?
About "Project dependent commands" could be associated with Project Type - yes indeed. I agree with that.
I even think that the commands should be provided with Agents. If the user is enabling certain Agents in the workspace - it will also make available a certain set of associated and pre-configured commands.
For example: If user enables the _MySQL_ Agent, it brings a set of commands to execute sql files.
How to recognize the command compatibility:
I believe there are two approaches for that:
mvn -version result before triggering any "mvn" command.At first, we need to extend the configurability options for commands and improve the associated UI and UX.
In second time, we'll be able to pre-configure commands for the pre-configured stacks and templates. Then we can extend capabilities with Project Type + Agents and hopefully IDE Actions.
No way to extend the Actions. They do what is logical for concrete context and do it nicely, with dedicated UX.
You can modify/add commands for the special cases instead.
It is two different things.
Agents...
I would keep them as simple as possible - just installation and running something specific but not limit something come from the image/recipe.
If I have MySQL provided with standard image, w/o Agent nothing should prevent me to call mySQL related commands/scripts.
Recognize command compatibility:
about agents :
If I have MySQL provided with standard image, w/o Agent nothing should prevent me to call mySQL related commands/scripts.
Eclipse Che could propose me to add some MySQL facets/tools by seeing that my image contains MySQL as well (and I could have some UI about MySQL for running scripts into my machine)
In the same way I expect that an IDE propose me to select the type of the project (or facets, builders, etc) I would also expect that it could check what is my runtime and propose tools matching this runtime.
If I have tomcat installed in the machine, maybe it could propose me to add the stop/start command for tomcat as well.
Yes, all of this can be implemented with IDE plugins
This should all be server-side, however. Maven as a plug-in is not bound to the IDE - only actions should be. So the maven-specific part of the command is managed as a set of server-side activities. But then in the IDE, there could be a maven IDE Plugin that introduces an action or a widget that is bound to the server-side plugin. The context of the client would be passed as an input into the server-side command.
Added Sub-tasks section