In Chapter 1: Plugin Migration Wrapper, we built a "shipping container" for our code. We learned that the wrapper holds our logic so it can be moved into the main application.
However, a shipping container without a label is useless. The factory doesn't know what is inside or where it should go.
In this chapter, we will learn about Command Configuration. This is the process of labeling our container so the system knows exactly what our tool is called and how to introduce it to the user.
Imagine you are hiring a new employee for a company. Before they can start working, they need an ID Card.
This ID card contains:
Without this ID card, the security guard (the CLI system) won't let them in, and other employees (the users) won't know they exist.
In our code, the Command Configuration is that ID card. It defines the identity of our plugin before any code actually runs.
We define this identity using a simple Javascript object (a list of key-value pairs). Here are the three most important fields on our ID card:
name)This is the unique keyword the user will type to run your tool. It should be short, lowercase, and use dashes instead of spaces.
pr-commentsdescription)This is the text that appears in the "Help" menu. It explains to the user what the tool does in plain English.
progressMessage)When your tool is working (fetching data from the internet), it might take a few seconds. This message keeps the user patient so they know the system hasn't frozen.
Let's look at how we write this in index.ts. We pass these settings directly into our wrapper function.
First, we set the name and the description. This is what the user sees when they list available commands.
// index.ts
export default createMovedToPluginCommand({
name: 'pr-comments',
description: 'Get comments from a GitHub pull request',
// ... (more settings follow)
})
Explanation:
name: When the user types pr-comments, this tool activates.description: If the user types help, they will see this sentence next to the command name.Next, we tell the system what to display while the tool is "thinking."
// index.ts continued...
progressMessage: 'fetching PR comments',
pluginName: 'pr-comments',
pluginCommand: 'pr-comments',
// ... (logic follows)
Explanation:
progressMessage: A spinner will appear with the text "fetching PR comments..." while the AI runs.pluginName and pluginCommand: These are internal fields required by the wrapper to ensure the wiring connects correctly to the main system. We usually keep them the same as the name.What happens when the application reads this configuration? It does not run your code immediately. It performs a Registration Phase.
index.ts file.name and description from our configuration object.Your actual logic (fetching GitHub data) is asleep until the user actually types the name.
Here is how the System uses the Configuration Object to interact with the User.
The function createMovedToPluginCommand (which we imported) acts as the registrar.
When we pass our object:
{
name: 'pr-comments',
description: 'Get comments...',
// ...
}
The wrapper takes this object and standardizes it. It ensures that even if the main application changes how it handles commands in the future, our plugin doesn't break because the wrapper handles the translation.
This separation allows us to define "What I am" (Configuration) separately from "What I do" (Logic).
In this chapter, we created the "ID Card" for our feature. We learned that:
name is what the user types.description is what shows in the help menu.progressMessage is what shows while loading.Now the system knows who our tool is. Next, we need to tell the tool exactly what to ask the AI when it wakes up.
Next Chapter: AI Prompt Generation
Generated by Code IQ