DEV Community

Cover image for How to ultra-over-engineer a useless piece of software (or why human interaction is important)

Posted on • Updated on

How to ultra-over-engineer a useless piece of software (or why human interaction is important)

(cover image: from here)

This is the story of the of the most useless (may be) npm package. I am warning you that this will be a waste of time.


Whenever I wanted to setup a new project, I used to always run these commands:

npm init -y
Enter fullscreen mode Exit fullscreen mode


git init .
git add .
git commit -m "Initial commit"
Enter fullscreen mode Exit fullscreen mode

So, I thought of automating it.

I thought of writing a tool (FML πŸ€¦β€β™‚οΈ!) that could execute a series of commands.


How does it work?

This will basically read a json file that has a schema object. This schema object should have key-value pairs of schemas.

User can select a schema by passing a cli argument (-l) that points to the json file containing schemas as key-value pairs:

Select Schema

--skip-confirm=true option is passed. Otherwise, user has to confirm the execution of each task.

This is a sample schema object. Here, there are tasks that will run sequentially, when the schema is run:

Sample Schema Object

This is how the tasks are run sequentially:

Tasks Execution

Observe the last task (no. 4). This task's command has placeholders

  • ${commit_head} and
  • ${commit_body}

Tasks Execution

So, the tool will

  • Parse the command
  • Take the values for each of the placeholder from the user (you can see something like, "Value for placeholder_0" in the image)
  • Replace the placeholders with these values
  • Execute the replaced command (Here, git commit -m "This is commit header" -m "This is detailed commit descriptions")

Structure Of Schema (You can skip and go to PS)

Each schema has the folowing structure:

  • description(string): Describes the schema
  • tasks(Array<{name: string, command: string}>): name property is a unique id for this object task object. command is the command to execute. command can take user inputs. If there is any placeholder in the string(in this form: ${user_input_1}), then the tool will parse it and asks the user for input for each of the placeholder.


You might be thinking,

"Why The F, would I ever use this instead of a simple shell script! This is a completely useless piece Of Sh*t!"

And, you would be ABSOLUTELY right.

This whole exercise made me realize why you should say your "awesome" ideas out loud, preferably, to other human beings.


Top comments (0)