A command-line interface (CLI) that helps you install, use, and configure the Autonomous Organization (AO). This package includes the command line tool `ao-cli` (alias `ao`) which makes it very easy to install and use the AO via the command line or a web browser. `ao-cli` is a Node/JavaScript CLI tool that wraps the functionality of Alchemy, AO administration, plus key AO features into one convenient interface.
A command-line interface (CLI) that helps you install, use, and configure the Autonomous Organization (AO). This package includes the command line tool `ao-cli` (alias `ao`) which makes it very easy to install and use the AO via the command line or a web browser. `ao-cli` is a Node/JavaScript CLI tool that wraps the functionality of Alchemy, AO administration, plus key AO features into one convenient interface. Command-line social networking.
To run immediately:
To run immediately:
@ -14,5 +14,5 @@ Then you can run with `ao-cli`. (Inside the menu you will find an option to add
// These should become .env variables that are loaded intelligently
constMANUAL_PATH=process.env.HOME+'/.ao/manual'
letdistro
letdistro
letmemberName
letmemberName
// Chalk styles
constgreenChalk=chalk.hex('#008800')
constheaderStyle=chalk.blue.bold.underline
constmanualTitleStyle=greenChalk.bold.underline
// Preformatted phrases that can be used in backticked console.log strings
consttheAO=`the ${greenChalk.bold('AO')}`
consttheMenu=`the ${greenChalk.bold('Menu')}`
// Different sets of messages that can be randomly selected from
constgreetingMessages=['Portaling!','You are a Unicorn!',"Here we go!","Wow!","AO Loading...","Powering Up!","Unicorn Portal","Don't Panic!"]
constwelcomeMessages=[
`You turn a corner and are suddenly back in the halls of ${theAO}.`,
`You make the sign of ${theAO} and are whisked away on a gust of divine wind.`,
`You take a closer look at the folder you are in and realize it is a room.`,
`You draw an alchemical symbol and open a doorway into ${theAO}. You step through.`,
`"Ah, there you are again!" The old man greets you as you step through the portal.`,
`A line of doge-masked worshippers glide by. By the time you exit the trance, you are in ${theAO}. Doge bless.`,
`You spraypaint an ${greenChalk.bold('A')} superimposed on an ${greenChalk.bold('O')} and step through the portal.`,
`You receive a phone call. You answer it. You are in ${theAO}.`,
`You dab fiercely, and when you raise your head, you are in ${theAO}.`,
`A ship arrives and takes you out to sea. The ship sinks and you somehow wash up safely in ${theAO}.`,
`You are reading in the Library when you find a strange book. Whatever you read next in the book is ${theAO}.`,
`You plant a magic seed and it grows into a great tree. Climbing up into its branches, you know ${theAO} is here.`,
`In the late afternoon, a warm sunbeam highlights motes of dust over your book. These motes are ${theAO}.`,
`A black cat crosses your path. Most people wouldn't notice, but you know you have entered the AO.`,
`Dipping your brush in ink, you draw a perfect circle. This is ${theAO}.`,
`You are offered a choice between two pills. However, you have secretly built up an immunity to both pills, and trick your opponent into taking one. Inconceviably, you are in ${theAO}.`,
`A young man with spiky hair and golden skin appears before you in a halo of light. He guides you to ${theAO}.`,
]
constmenuMessages=[
`You see ${theMenu}:`,
`A page of aged paper wafts into your hand. On it is written ${theMenu}:`,
`A minstrel walks by playing a haunting melody, and in its harmonies you hear the refrain of ${theMenu}:`,
`You pick up an apple from a nearby table and take a bite. You suddenly recall the words of ${theMenu}:`,
`With a screeching sound, a page containing ${theMenu} slowly emerges, line-by-line, from a dot-matrix printer:`,
`In the shadows cast in the cavernous space, you see the forms of ${theMenu}:`,
`With a low hum, standing waves appear on the reflecting pool at your feet. Impossibly, they spell out ${theMenu}:`,
`You see a box of candies labeled 'Eat Me'. Why not? you think. You find ${theMenu} printed on the wrapper:`,
`You see an ornate bottle labeled 'Drink Me'. Why not? you think. You take a sip and shrink to the size of a doormouse. Now you can read ${theMenu} scratched into the wainscoating:`,
`Cretaceous jungle plants tower overhead, overgrown from the safari room. The ancient fractals of the branches prefigure the structure of ${theMenu}:`,
]
constexclamationMessages=[
'Woah there!',
'Shiver me timbers!',
'iNtErEsTiNg!',
'Turing\'s ghost!',
'Frack!',
'Frell!',
'Good grief!',
'With great power comes great responsibility.',
]
constfarewellMessages=[
'Goodbye!',
'Goodbye! Goodbye! Goodbye...!',
'The AO will always be with you.',
'Please return soon; the AO needs your virtue.',
'The AO will await your return.',
'Doge bless.',
'Please remember the AO throughout your day as a ward against evil.',
'Remember your PrioriTEA™.',
'Know thyself.',
'With great power comes great responsibility.',
'The AO is a state of mind.'
]
// Returns a random int between min and max (inclusive)
console.log(`${chalk.red.bold(selectRandom(exclamationMessages))} Seems you're running this script as a superuser.`)
console.log(`${chalk.red.bold(exclaim())} Seems you're running this script as a superuser.`)
console.log('That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I\'ll ask you when I need superuser permissions')
console.log('That might cause some issues with permissions and whatnot. Run this script as your default user (without sudo) and I\'ll ask you when I need superuser permissions')
process.exit(1)
process.exit(1)
}catch(err){}
}catch(err){}
}
}
// Check for an AO env file at ~/.ao/.env and returns true if it exists
functionloadAoEnvFile(){
try{
execSync('[ -f "~/.ao/.env" ]')
console.log('AO .env file exists at ~/.ao/.env')
returntrue
}catch(err){
console.log('AO .env file does not exist at ~/.ao/.env')
returnfalse
}
}
// Displays a brief randomly-selected rainbow-animated phrase
console.log(`\n${headerStyle('AO Public Chatrooms')}\n`)
constanswer=awaitinquirer.prompt({
name:'chat_menu',
type:'list',
message:'Please choose:',
choices:chatChoices
})
switch(answer.chat_menu){
case'Enable p2p bootstrap':
console.log('In order to join AO public chatrooms, AO uses the hyperswarm protocol. Joining hyperswarm may expose your IP address to other users. (For high-security installations, don\'t use public bootstrap: you can still add tor addresses to your address book manually and join those chatrooms by name.)')
setAoEnv('PUBLIC_BOOTSTRAP_ENABLED',true)
//message: Type \'public\' and press Enter to enable:')
break
case'Disable p2p bootstrap':
setAoEnv('PUBLIC_BOOTSTRAP_ENABLED',false)
console.log(roger(),'Disabled public bootstrapping.')
if(publicBootstrapStarted){
// stop the bootstrap thing here
publicBootstrapStarted=false
}
break
case'Join public chatroom':
console.log('Not yet implemented')
break
case'Join chatroom':
console.log('Not yet implemented')
break
case'Address Book':
console.log('The point of this address book is to make it possible to type short, one-word names and have them resolve to tor addresses.')
console.log('Name a piece of data by saying name=data. For example, doge=5uc41o1...onion. Then \'doge\' will return the .onion address.')
console.log('Querying with any synonym in a chain will return the final meanings they all point to.')
console.log('Keys can have multiple values.')
break
case'Back to Main Menu':
returnfalse
}
returntrue
}
// Prints the AO Admin Menu and executes the user's choice
// Prints the AO Admin Menu and executes the user's choice
asyncfunctionadminMenu(){
asyncfunctionadminMenu(){
console.log(`\n${headerStyle('AO Admin Menu')}`)
console.log(`\n${headerStyle('AO Admin Menu')}`)
@ -244,7 +194,7 @@ async function adminMenu() {
// Prints the AO Unit Tests Menu and executes the user's choice
// Prints the AO Unit Tests Menu and executes the user's choice
// Different sets of messages that can be randomly selected from
constwelcomeMessages=[
`You turn a corner and are suddenly back in the halls of ${theAO}.`,
`You make the sign of ${theAO} and are whisked away on a gust of divine wind.`,
`You take a closer look at the folder you are in and realize it is a room.`,
`You draw an alchemical symbol and open a doorway into ${theAO}. You step through.`,
`"Ah, there you are again!" The old man greets you as you step through the portal.`,
`A line of doge-masked worshippers glide by. By the time you exit the trance, you are in ${theAO}. Doge bless.`,
`You spraypaint an ${greenChalk.bold('A')} superimposed on an ${greenChalk.bold('O')} and step through the portal.`,
`You receive a phone call. You answer it. You are in ${theAO}.`,
`You dab fiercely, and when you raise your head, you are in ${theAO}.`,
`A ship arrives and takes you out to sea. The ship sinks and you somehow wash up safely in ${theAO}.`,
`You are reading in the Library when you find a strange book. Whatever you read next in the book is ${theAO}.`,
`You plant a magic seed and it grows into a great tree. Climbing up into its branches, you know ${theAO} is here.`,
`In the late afternoon, a warm sunbeam highlights motes of dust over your book. These motes are ${theAO}.`,
`A black cat crosses your path. Most people wouldn't notice, but you know you have entered the AO.`,
`Dipping your brush in ink, you draw a perfect circle. This is ${theAO}.`,
`You are offered a choice between two pills. However, you have secretly built up an immunity to both pills, and trick your opponent into taking one. Inconceviably, you are in ${theAO}.`,
`A young man with spiky hair and golden skin appears before you in a halo of light. He guides you to ${theAO}.`,
`You enter a gap between two hedges and, after struggling through the brush, emerge into a sunny estate garden. You've found the AO.`,
`You find a small animal burrow dug near the riverside. Crawling in, you find a network of caves that lead to the AO.`
]
constmenuMessages=[
`You see ${theMenu}:`,
`A page of aged paper wafts into your hand. On it is written ${theMenu}:`,
`A minstrel walks by playing a haunting melody, and in its harmonies you hear the refrain of ${theMenu}:`,
`You pick up an apple from a nearby table and take a bite. You suddenly recall the words of ${theMenu}:`,
`With a screeching sound, a page containing ${theMenu} slowly emerges, line-by-line, from a dot-matrix printer:`,
`In the shadows cast in the cavernous space, you see the forms of ${theMenu}:`,
`With a low hum, standing waves appear on the reflecting pool at your feet. Impossibly, they spell out ${theMenu}:`,
`You see a box of candies labeled 'Eat Me'. Why not? you think. You find ${theMenu} printed on the wrapper:`,
`You see an ornate bottle labeled 'Drink Me'. Why not? you think. You take a sip and shrink to the size of a doormouse. Now you can read ${theMenu} scratched into the wainscoating:`,
`Cretaceous jungle plants tower overhead, overgrown from the safari room. The ancient fractals of the branches prefigure the structure of ${theMenu}:`,
]
constexclamationMessages=[
'Woah there!',
'Shiver me timbers!',
'iNtErEsTiNg!',
'Turing\'s ghost!',
'Frack!',
'Frell!',
'Good grief!',
'With great power comes great responsibility.',
]
constrogerMessages=[
'You\'ve got it.',
'Aye-aye, captain!',
'The AO provides.',
'Roger.',
'Yokai.'
]
constfarewellMessages=[
'Goodbye!',
'Goodbye! Goodbye! Goodbye...!',
'The AO will always be with you.',
'Please return soon; the AO needs your virtue.',
'The AO will await your return.',
'Doge bless.',
'Please remember the AO throughout your day as a ward against evil.',
'Remember your PrioriTEA™.',
'Know thyself.',
'With great power comes great responsibility.',
'The AO is a state of mind.',
'Go for the low-hanging fruit.'
]
// Prints a random RPG-style welcome message to contextualize the AO experience and the main menu