Robert Brennan 1eade7d188
First pass at a control loop (#35)
* initialize control loop

* add todo

* more todo

* add dockerignore

* add notes to prompt

* encourage llm to finish

* add debug env

* update prompts a bit

* fix task prompts

* add basic regression framework

* add hello-world regression case

* add hello-name test case

* fix workspace ignore

* document regression script

* add python-cli test case

* add default git config

* add help regression test

* add node rewrite test case

* add react-todo test case

* fix dockerfile

* add ability to run background commands

* add client-server test case

* update regression readme

* better support for background commands

* update tests

* fix bug in command removal
2024-03-20 18:44:50 +08:00

34 lines
943 B
JavaScript

const process = require('process');
const commands = require('./commands');
function printHelp() {
const helpText = `
Usage: node cli.js <command> <string>
Commands:
reverse - Reverses the input string.
uppercase - Converts the input string to uppercase.
lowercase - Converts the input string to lowercase.
spongebob - Converts the input string to spongebob case.
length - Returns the length of the input string.
scramble - Randomly scrambles the characters in the input string.
`;
console.log(helpText);
}
if (process.argv.length === 3 && process.argv[2] === '--help') {
printHelp();
process.exit(0);
} else if (process.argv.length < 4) {
console.log('Usage: node cli.js <command> <string>');
process.exit(1);
}
const command = process.argv[2];
const inputString = process.argv[3];
if (command in commands) {
console.log(commands[command](inputString));
} else {
console.log('Invalid command!');
}