Search

US-12619445-B2 - Command line script automation by monitoring execution of completed tasks

US12619445B2US 12619445 B2US12619445 B2US 12619445B2US-12619445-B2

Abstract

Computer implemented methods, systems, and computer program products include program code executing on a processor(s) that monitors execution of a script to complete a task via a command line interface, and based on completing the task, generates, based on the script, a non-directional representation of the script and a directional representation of the script. The processor(s) clusters the non-directional representation of the script with non-directional representations of similar scripts (successfully in advance of the monitoring). The processor(s) merges the directional representation of the script to a cluster comprising the non-directional representation of the script.

Inventors

  • Raymund Lin
  • Nan Chen
  • Ju Ling Liu
  • Ye Chuan Wang
  • Li Na Wang

Assignees

  • INTERNATIONAL BUSINESS MACHINES CORPORATION

Dates

Publication Date
20260505
Application Date
20240118

Claims (20)

  1. 1 . A computer-implemented method of assisting command line script entry, the method comprising: monitoring, by one or more processors, execution of a script to complete a task via a command line interface; based on the task being complete, generating, by the one or more processors, based on the script, a non-directional representation of the script and a directional representation of the script, wherein the directional representation of the script comprises complete execution paths; clustering, by the one or more processors, the non-directional representation of the script with non-directional representations of similar scripts, wherein the similar scripts were executed successfully in advance of the monitoring; and merging, by the one or more processors, the directional representation of the script to a cluster comprising the non-directional representation of the script.
  2. 2 . The computer-implemented method of claim 1 , wherein the non-directional representation of the script comprises a first graph wherein each node in the first graph comprises a command and a target in the script.
  3. 3 . The computer-implemented method of claim 2 , wherein first graph represents how frequently the command and the target are executed together.
  4. 4 . The computer-implemented method of claim 1 , wherein the directional representation of the script comprises a second graph wherein each node in the second graph comprises a command, a target, and a parameter in the script.
  5. 5 . The computer-implemented method of claim 1 , further comprising: determining, by the one or more processors, commencement of entry of a new script to accomplish a new task via the command line interface; progressively obtaining, by the one or more processors, text comprising portions of the new script, via the command line interface; and based on the obtaining, comparing, by the one or more processors, a portion of the new script to the directional representation of the script based on identifying at least one similar path between the new script and the directional representation of the script.
  6. 6 . The computer-implemented method of claim 5 , further comprising: based on the comparing, identifying, by the one or more processors, the at least one similar path; and utilizing, by the one or more processors, the at least one similar path, to suggest, via a user interface, a next text input to enter via the command line interface.
  7. 7 . The computer-implemented method of claim 6 , further comprising: utilizing, by the one or more processors, each node in the at least one similar path to continue suggesting sequential text inputs via the user interface; and determining, by the one or more processors, that the new task is complete.
  8. 8 . The computer-implemented method of claim 7 , further comprising: publishing, by the one or more processors, text entries in the command line interface from the commencement of the entry to the determining the task is complete as a second script; generating, by the one or more processors, based on the second script, a non-directional representation of the second script and a directional representation of the second script; clustering, by the one or more processors, utilizing a machine learning algorithm, the non-directional representation of the second script with non-directional representations of scripts similar to the second script, wherein the scripts similar to the second script were executed successfully in advance of the publishing; and merging, by the one or more processors, the directional representation of the second script to a second cluster comprising the non-directional representation of the script.
  9. 9 . The computer-implemented method of claim 5 , wherein the task and the new task are selected from the group consisting of: installing a given software package and configuring the given software package.
  10. 10 . The computer-implemented method of claim 5 , further comprising: based on the comparing, not identifying, by the one or more processors, the at least one similar path; monitoring, by the one or more processors, execution of the new script; determining, by the one or more processors, that the new task has been completed successfully; generating, by the one or more processors, based on the new script, a non-directional representation of the new script and a directional representation of the new script; and generating, by the one or more processors, a new cluster based on the non-directional representation of the new script and the directional representation of the new script.
  11. 11 . The computer-implemented method of claim 1 , wherein a script exchange portal client performs the monitoring.
  12. 12 . The computer-implemented method of claim 5 , wherein the at least one similar path comprises at least three common nodes between the portion of the new script and the directional representation of the script.
  13. 13 . The computer-implemented method of claim 1 , further comprising: prior to generating the non-directional representation of the script and the directional representation of the script, sanitizing, by the one or more processors, the script.
  14. 14 . The computer-implemented method of claim 8 , wherein publishing the second script comprises publishing the second script to a script exchange portal server.
  15. 15 . The computer-implemented method of claim 1 , wherein clustering the non-directional representation of the script with the non-directional representations of the similar scripts comprises: determining, by the one or more processors, the script is similar to the non-directional representations of the similar scripts, wherein the determining comprises: calculating, by the one or more processors, a distance between each node of the script in the non-directional representations and each node in one or more non-directional representations of other scripts; and identifying, by the one or more processors, the non-directional representations of the similar scripts from the one or more non-directional representations of the other scripts based on the distance being within a pre-determined threshold.
  16. 16 . The computer-implemented method of claim 15 , wherein the distance comprises a text distance.
  17. 17 . The computer-implemented method of claim 4 , wherein the clustering comprises applying a machine learning algorithm, the method further comprising: training, by the one or more processors, the machine learning algorithm utilizing the similar scripts as training data.
  18. 18 . The computer-implemented method of claim 1 , further comprising: determining, by the one or more processors, that the task has been completed successfully.
  19. 19 . A computer system for assisting command line script entry, the computer system comprising: a memory; and one or more processors in communication with the memory, wherein the computer system is configured to perform a method, said method comprising: monitoring, by the one or more processors, execution of a script to complete a task via a command line interface; based on the task being complete, generating, by the one or more processors, based on the script, a non-directional representation of the script and a directional representation of the script, wherein the directional representation of the script comprises complete execution paths; clustering, by the one or more processors, utilizing a machine learning algorithm, the non-directional representation of the script with non-directional representations of similar scripts, wherein the similar scripts were executed successfully in advance of the monitoring; and merging, by the one or more processors, the directional representation of the script to a cluster comprising the non-directional representation of the script.
  20. 20 . A computer program product for assisting command line script entry, the computer program product comprising: one or more computer readable storage media and program instructions collectively stored on the one or more computer readable storage media readable by at least one processing circuit to: monitor execution of a script to complete a task via a command line interface; based on the task being complete, determine that the task has been completed successfully; generate, based on the script, a non-directional representation of the script and a directional representation of the script, wherein the directional representation of the script comprises complete execution paths; cluster, utilizing a machine learning algorithm, the non-directional representation of the script with non-directional representations of similar scripts, wherein the similar scripts were executed successfully in advance of the monitoring; and merge the directional representation of the script to a cluster comprising the non-directional representation of the script.

Description

BACKGROUND The present invention relates generally to the field of system and application configuration and in particular, a method for efficiently and reliably providing a correct command line for configuration. The command line is a text interface that takes in commands, which it passes on to the computer's operating system to run. From the command line, for example, a user can navigate through files and folders on a computer. The command line can sometimes be referred to as a command line interface (CLI), a command-line user interface, a console user interfaces and/or a character user interface. In addition to navigation, the CLI, a text-based user interface (UI), can be utilized to run programs, manage computer files and interact with the computer. Command-line interfaces are also called command-line user interfaces, console user interfaces and character user interfaces. A user, including an administrator, can utilize the CLI to enter commands to manage the system. For example, one can utilize command line configuration to quickly update configuration values rather than make these changes through a configuration tool user interface. When utilizing the CLI to make system and/or application configuration changes, a user or administrator may need to run dozens of command lines both to implement the desired changes and to have the result of the commands be a functioning system and/or application. Because the commands are entered in a short text string, a small typographical error can lead to an undesired result. Additionally, depending on the familiarity of the user with the product (application and/or system) the user is configuring, the user could take time to detect a command line error and hence, may have to repeat part or all of the process in order to address the issue. Artificial intelligence (AI) refers to intelligence exhibited by machines. Artificial intelligence (AI) research includes search and mathematical optimization, neural networks, and probability. Artificial intelligence (AI) solutions involve features derived from research in a variety of different science and technology disciplines ranging from computer science, mathematics, psychology, linguistics, statistics, and neuroscience. Machine learning has been described as the field of study that gives computers the ability to learn without being explicitly programmed. SUMMARY Shortcomings of the prior art are overcome, and additional advantages are provided through the provision of a computer-implemented method for assisting command line script entry. The method can include: monitoring, by one or more processors, execution of a script to complete a task via a command line interface; based on the task being complete, generating, by the one or more processors, based on the script, a non-directional representation of the script and a directional representation of the script, wherein the directional representation of the script comprises complete execution paths; clustering, by the one or more processors, the non-directional representation of the script with non-directional representations of similar scripts, wherein the similar scripts were executed successfully in advance of the monitoring; and merging, by the one or more processors, the directional representation of the script to a cluster comprising the non-directional representation of the script. Shortcomings of the prior art are overcome, and additional advantages are provided through the provision of a computer program product for assisting command line script entry. The computer program product comprises a storage medium readable by a one or more processors and storing instructions for execution by the one or more processors for performing a method. The method includes, for instance: monitoring, by the one or more processors, execution of a script to complete a task via a command line interface; based on the task being complete, generating, by the one or more processors, based on the script, a non-directional representation of the script and a directional representation of the script, wherein the directional representation of the script comprises complete execution paths; clustering, by the one or more processors, the non-directional representation of the script with non-directional representations of similar scripts, wherein the similar scripts were executed successfully in advance of the monitoring; and merging, by the one or more processors, the directional representation of the script to a cluster comprising the non-directional representation of the script. Shortcomings of the prior art are overcome, and additional advantages are provided through the provision of a system for assisting command line script entry. The system includes: a memory, one or more processors in communication with the memory, and program instructions executable by the one or more processors via the memory to perform a method. The method includes, for instance: monitoring, by the one or more processors, executi