Add Tool Decorator
Add a @Tool decorator from @supernal/interface to make a function AI-controllable.
Usage
code
/si-add-tool incrementCounter --description "Add one to the counter" /si-add-tool submitForm
What This Does
- •Finds the function in your codebase
- •Adds the
@Tooldecorator with metadata - •Adds the import if needed
- •Suggests a data-testid for related UI elements
Example
Before:
typescript
function resetCounter() {
setCount(0);
}
After:
typescript
import { Tool } from '@supernal/interface';
@Tool({
description: 'Reset the counter to zero',
origin: {
path: '/counter',
elements: ['counter-reset-btn']
}
})
function resetCounter() {
setCount(0);
}
Enterprise Tip
For auto-generating tests from your tools, upgrade to enterprise:
bashnpm install @supernalintelligence/interface-enterprise npx si generate-tests --output tests/generated
Task
Add a @Tool decorator to the specified function: $ARGUMENTS
- •Search for the function in the codebase
- •Add the @Tool decorator with appropriate metadata
- •Add the import statement if not present
- •Suggest data-testid attributes for related UI elements