Create Quick Command: IDE
Creating your Quick Command
Follow the steps below to create:
Step 1. Access the StackSpot AI Portal
Step 2. On the left-side menu, click ‘Contents > Quick Command’
Step 3. Click on the ‘Create Custom Quick Command’ button;
Step 4. Select the IDE option;
Step 5. Fill out the fields to add information about your Quick Command.
See an example below:
-
Quick Command Name: Add a name for your Command. Example: Technical Debt
-
Command: Add a name you will use it later; it should follow the slug pattern. For more information about Slugs, see the slug pattern. Example: technical_debt_1
-
Description: Add a description of what your Command can do. Example: Create an issue on GitHub highlighting technical debt on the selected code and suggest a corrective action.
Step 6. Click the 'Next' button. You can use the available templates (which are already pre-filled) or create one from scratch, according to your preferences.
See the example:
Follow the workflow on the screen. Click on 'add button'. Choose ‘Prompt’
Creating a 'Prompt' Quick Command
See below an example creating a 'Prompt' Quick Command:
1. Click 'Create blank'. Then drag and drop the 'Prompt' box to the 'Start'. You must connect the boxes with the blue line;
2. Fill out the fields on the prompt box:
- Prompt name: Add a slug identifier following the slug pattern. See an example:
/issue-title
- Insert your prompt: Write down what you want your command to do.
If you want the user to select a specific code extract, insert the {{ selected_code }}
in the designated place. Adding this option sends the information to StackSpot AI and make it easier to understand.
See the example: Read this {{ selected_code }}
and write a title of up to 80 characters for a GitHub issue.
- Use the current Stack to generate code: This option depends on your needs.
- When enabled, it considers the context of your Stack and generates code based on whether you have a Java or Python Stack, for example. If you require code generation, then this option is recommended.
- However, if you need to generate text, like translations, it's best to refrain from enabling this option as it may not yield optimal results.
3. Select Knowledge Sources
This is not required. You should choose this option when creating a Quick Command and you want to select a specific context from a Knowledge Source. This option is useful when creating a command requiring detailed knowledge, such as searching for vulnerabilities based on security policies.
4. Select Agents
You can select agents when creating a Quick Command. These agents will be consulted whenever the user utilizes this prompt.
5. Click on the 'Save' button, then connect the line of your prompt box to the 'Finish' box.
6. Click 'Finish' and fill out the *Quick Command Utilization screen:
- Choose the way the user can interact with your Quick Command in the IDE, see below:
-
Interface: The user gives the command, and the content shows in the sidebar of the StackSpot AI Extension.
-
Code: The user gives the command, the content will be pasted directly into the code or:
-
Above the selected code
-
Below the selected code
-
Replace the selected code
-
Insert .answer after the name of your Quick Command (only if it is a prompt option):
{{ title_issue.answer }}
7. Click on the 'Save' button.
The command can use the Jinja format.
See the example below:
Creating a 'Web Request' Quick Command
In this example, we are creating a Quick Command to open a GitHub issue.
1. Creating a Web Request, you have to drag and drop the 'Web request' box near the 'Start' one.
2. Fill out the fields:
- Web request name: Add a request name following the slug pattern.
Example: /github_request
- HTTP Method: Choose a HTTP method.
Example: GET
- URL Endpoint: Add the Endpoint URL.
Example: https://api.example.com/users
- Headers:
Example:
{
"content-type":"application/json",
"authorization":"Bearer your_access_token"
}
- Request Body:
Example:
{
"name": "John".
"age": 30
}
Use Jinja to interpolate values in the URL endpoint, headers, and request body. For example, add a variable such as {{selected_code}}
in the URL or header.
3. Click 'Finish' and fill out the Quick Command Utilization. Choose the way the user can interact with your Quick Command in the IDE, see below:
-
Interface: The user gives the command, and the content shows in the sidebar of the StackSpot AI Extension.
-
Code: The user gives the command, the content will be pasted directly into the code or:
-
Above the selected code
-
Below the selected code
-
Replace the selected code
-
Final result: This option shows the success message that the user will see using your Quick Command. You can edit the message and choose the utilization mode as well. See the example below showing the URL to create a GitHub issue:
Final result
Insert {
to view the predefined input options or click on the tags below:
select_mode
, title_issue
, summarize
, propose_improvement
;
-
Use chat context: This option uses previous Quick Command responses and interactions as context for subsequent interactions in a specific chat session. You can use this option to have a more coherent and contextually enriched experience across your interactions within the platform. StackSpot AI uses past inputs and responses to inform and enhance your future commands and responses.
-
Use Indexed Project: Activate the indexed project at this step to utilize indexed files and enhance the context in the Quick Command. After a project is indexed, the Quick Commands feature uses this data to create more accurate and relevant commands and workflows. This should result in suggestions customized for the specific environment of the indexed project.
Your issue was successfully created at the following URL:
{{create_issue.json[0].url}}
4. Click on the ‘Save > Finish’ buttons;
You can make changes to your Quick Command; just click in the 'Command Flow' area.
How can I navigate every step of that creation flow?
When the response is a JSON, you can browse specific parts of the previous steps you did on the creation flow. You can work with the attributes, the values, etc. This step is essential because you can extract what the user needs. For example, a field of that service you created, a header, what was the status, etc.
If you need to know any value from the previous steps, add the information below:
1. Web Request See below a server that can return the following object format:
Headers: {"headers_name": "value", ...}
data: text
status: [200-599]
json: json - dictionary of the "data"
Example: {{create_issue.json[0].url}}
- If the data you receive is in JSON format, you can easily navigate through your data's values and attributes.
- The
json
field will be empty if it is not a JSON.
2. Prompt By default, you can navigate through the following fields:
answer: string
prompt_tokens: string
completion_tokens: string
total_cost: Decimal
Example: {{my_prompt.answer}}
What can you do next?
1. Add Inputs
2. Share Quick Command
You can share the Quick Command you created with other users. This will enable direct use within the IDEs in the Account.
- On the 'Quick Commands' screen, click the share button on the left side of the StackSpot AI Portal to share.
3. Add to a Workspace to make this Quick Command available for the users in your organization
After creating your Quick Command, add it to your Studio or a Workspace, depending on your permission.
See if you have permission to do it. If you need help, contact your account administrator.
Follow the instructions:
- On the left side menu, access 'Workspace';
- Click 'Add Quick Command';
- Select the commands you want and click 'Add Quick Command.'
- You can find Knowledge Sources inside the Workspace with the Quick Command. However, using a Quick Command does not affect the Knowledge Sources.
- The only Knowledge Sources that affect your Quick Command are the ones you added while creating the command.
Delete Quick Command (QC) linked to a Workspace
This action is irreversible.
Deleting a Quick Command (QC) with a linked Workspace or Studio may affect certain users. Follow these steps to delete:
- On left-side menu click ‘Quick Command’;
- Select the Quick Command you want to delete and click ‘Settings’;
- Click the ‘Delete’ button.