@ariska138/stepcode
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

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 -g

Features

  • 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

stepcode

The CLI will:

  1. Look for .builder.json files in the current directory
  2. If only instruction.builder.json exists, use it automatically
  3. If multiple builder files exist, prompt you to select one
  4. 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:

  1. 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
  2. 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 dev@finlup.id

Donate

Donasi Coffee 🍕 Donasi Pizza

Package Sidebar

Install

npm i @ariska138/stepcode

Weekly Downloads

23

Version

1.1.5

License

MIT

Unpacked Size

700 kB

Total Files

101

Last publish

Collaborators

  • ariska138