@ariska138/stepcode
v1.1.5
Published
Step by step code manipulation CLI tool
Maintainers
Readme
StepCode
A step-by-step code manipulation CLI tool that helps developers generate and modify code, files, folders, and run commands in a project.
Installation
npm install stepcode -gFeatures
File Operations:
- Create, delete, move, and rename files
- Create, delete, move, and rename folders
- Set or update file contents
- Find and modify specific content in files
- Smart content matching (ignores extra whitespace, tabs, and newlines)
Command Operations:
- Run shell commands
- Interactive command confirmation
Usage
Create a instruction.builder.json file in your project root with your desired steps. You can have multiple .builder.json files for different purposes.
Basic Example
[
{
"action": "create-folder",
"path": "src/components",
"description": "Create components directory"
},
{
"action": "create-file",
"path": "src/components/Button.tsx",
"content": "export const Button = () => {\n return <button>Click me</button>\n}",
"description": "Create Button component"
}
]Running the Tool
stepcodeThe CLI will:
- Look for
.builder.jsonfiles in the current directory - If only
instruction.builder.jsonexists, use it automatically - If multiple builder files exist, prompt you to select one
- Ask whether to run steps manually or automatically
Available Actions
File Operations
Create File
{
"action": "create-file",
"path": "path/to/file.txt",
"content": "File content here",
"description": "Create new file"
}Delete File
{
"action": "delete-file",
"path": "path/to/file.txt",
"description": "Delete file"
}Move File
{
"action": "move-file",
"path": "original/path/file.txt",
"newPath": "new/path/file.txt",
"description": "Move file to new location"
}Rename File
{
"action": "rename-file",
"path": "path/file.txt",
"newPath": "path/newname.txt",
"description": "Rename file"
}Content Operations
Set Content
{
"action": "set-content",
"path": "path/to/file.txt",
"content": "This will replace the entire file content",
"description": "Replace file content"
}Find and Update Content
{
"action": "find-content-to-update",
"path": "path/to/file.txt",
"searchText": "text to find",
"replaceWith": "replacement text",
"description": "Update specific content"
}Find and Add Content
{
"action": "find-content-to-add",
"path": "path/to/file.txt",
"searchText": "text to find",
"content": "content to add after found text",
"description": "Add content after specific text"
}Find and Delete Content
{
"action": "find-content-to-delete",
"path": "path/to/file.txt",
"searchText": "text to delete",
"description": "Delete specific content"
}Folder Operations
Create Folder
{
"action": "create-folder",
"path": "path/to/folder",
"description": "Create new folder"
}Delete Folder
{
"action": "delete-folder",
"path": "path/to/folder",
"description": "Delete folder"
}Move Folder
{
"action": "move-folder",
"path": "original/path",
"newPath": "new/path",
"description": "Move folder to new location"
}Rename Folder
{
"action": "rename-folder",
"path": "path/folder",
"newPath": "path/newname",
"description": "Rename folder"
}Command Operations
Run Command
{
"action": "run-command",
"command": "npm install",
"description": "Install dependencies"
}Confirm Command
{
"action": "confirm-command",
"command": "git status",
"confirmationMessage": "Check git status?",
"description": "Check git status with confirmation"
}Special Features
Smart Content Matching
When using content operations (find-content-to-update, find-content-to-delete, find-content-to-add), the tool uses smart matching that:
- Ignores extra whitespace
- Ignores tabs and newlines
- Treats multiple spaces as a single space
- Preserves original formatting when making changes
This makes it easier to match content without worrying about exact whitespace matching.
Running Modes
The tool supports two running modes:
Step by Step (Manual)
- Review each step before execution
- Choose to execute, skip, or view details of each step
- Perfect for learning and careful execution
All at Once (Automatic)
- Executes all steps automatically
- Faster for known and tested operations
- Good for automation and scripting
Error Handling
The tool provides:
- Clear error messages
- Step-by-step feedback
- Progress indicators
- Confirmation for destructive operations
Contributing
Issues and pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
UNLICENSED
Author
Finlup Engineering Team [email protected]
Donate
:coffee: Donasi Coffee 🍕 Donasi Pizza
