diff --git a/docs/help.md b/docs/help.md new file mode 100644 index 0000000..ecc0cf3 --- /dev/null +++ b/docs/help.md @@ -0,0 +1,172 @@ +# pwcli Help Documentation + +**pwcli** is a CLI for Photowall platform that provides commands for deployment, AWS operations, workflow automation, and more. + +## Usage + +Run `pwcli` to start the interactive menu, or use command shortcuts directly: + +```bash +pwcli [command] [subcommand] [action] +``` + +### Command Shortcuts + +Commands can be executed using their aliases. For example: +- `pwcli d ts s` โ†’ deployment testservers status +- `pwcli a ps l` โ†’ aws parameterstore list +- `pwcli wf g cb` โ†’ workflow git clean_old_branches + +--- + +## Available Commands + +### ๐Ÿค– **ai** (alias: `ai`) +AI-related commands + +#### Subcommands: +- **promptcontextlibrary** (alias: `pcl`) - Copy context files to clipboard for AI prompts + +**Example:** `pwcli ai pcl` + +--- + +### โ˜๏ธ **aws** (alias: `a`) +AWS operations and management + +#### Subcommands: + +##### **ecs** (alias: `e`) - Working with ECS on AWS +- **sshtestserver** (alias: `sts`) - SSH into a test server in ECS + +**Example:** `pwcli a e sts` + +##### **logs** (alias: `l`) - Tail a log in CloudWatch (WIP) + +**Example:** `pwcli a l` + +##### **parameterstore** (alias: `ps`) - Working with parameter store on AWS +- **bulk-create** (alias: `bc`) - Bulk create parameters from JSON file +- **create** (alias: `c`) - Create a new item in parameter store +- **list** (alias: `l`) - List all parameters in parameter store +- **update** (alias: `u`) - Update an existing item in parameter store + +**Examples:** +- `pwcli a ps l` - List parameters +- `pwcli a ps c` - Create parameter +- `pwcli a ps bc` - Bulk create from JSON file + +##### **pipeline** (alias: `pl`) - Pipeline operations +- **status** (alias: `s`) - View pipeline status with live tracking + +**Example:** `pwcli a pl s` + +##### **s3** (alias: `s3`) - Working with S3 on AWS +- **clear_prints** (alias: `cp`) - Clear prints-dev bucket on S3 +- **print_on_station** (alias: `pos`) - Print on a real station (copies from dev to production) +- **sync_images** (alias: `si`) - Sync images between S3 buckets + +**Examples:** +- `pwcli a s3 si` - Sync images +- `pwcli a s3 cp` - Clear prints + +--- + +### ๐Ÿš€ **deployment** (alias: `d`) +Deployment and test server management + +#### Subcommands: + +##### **testservers** (alias: `ts`) - Deploy to testservers +- **create** (alias: `c`) - Create new testserver on AWS +- **delete** (alias: `d`) - Choose a testserver to delete +- **status** (alias: `s`) - Show status for available testservers +- **update** (alias: `u`) - Update stack with different branch + +**Examples:** +- `pwcli d ts s` - View testserver status +- `pwcli d ts c` - Create new testserver +- `pwcli d ts u` - Update existing testserver + +--- + +### ๐Ÿ“ง **mandrill** (alias: `m`) +Mandrill/Mailchimp email template operations + +#### Subcommands: +- **fix_template** (alias: `ft`) - Remove incorrect artifacts caused by Mailchimp export to Mandrill + +**Example:** `pwcli m ft` + +--- + +### โš™๏ธ **setup** (alias: `s`) +Setup pwcli configuration + +#### Subcommands: +- **settings** (alias: `se`) - Setup settings for pwcli (GitHub token, repo paths, API keys, etc.) + +**Example:** `pwcli setup settings` or `pwcli s se` + +--- + +### ๐Ÿงช **test** (alias: `t`) +Test commands + +#### Subcommands: +- **routes** (alias: `r`) - Test pre-configured routes for 200 status on configured localhost + +**Example:** `pwcli t r` + +--- + +### ๐Ÿ”„ **update** (alias: `up`) +Update pwcli to the latest version from main branch and rebuild + +**Example:** `pwcli update` or `pwcli up` + +--- + +### ๐Ÿ”ง **workflow** (alias: `wf`) +Workflow tools for development + +#### Subcommands: + +##### **git** (alias: `g`) - Tools for git to make repo life easier +- **clean_local_branches** (alias: `clb`) - Clean local branches without origin connection +- **clean_old_branches** (alias: `cb`) - Prune remote and clean local branches if gone + +**Examples:** +- `pwcli wf g cb` - Clean old branches +- `pwcli wf g clb` - Clean local branches + +##### **setupissue** (alias: `si`) - Setup everything for an issue +Creates a new branch from origin/master based on a GitHub issue + +**Example:** `pwcli wf si` + +--- + +## Configuration + +Run `pwcli setup settings` to configure: +- GitHub access token +- Local photowall repository path +- Mandrill API key +- Localhost URL and credentials for testing + +Settings are stored in `~/.pwcli_settings` + +--- + +## Tips + +- Use the interactive menu by running `pwcli` without arguments +- Chain command aliases for faster execution: `pwcli d ts s` +- Most commands require AWS CLI to be installed and configured +- Some commands require settings to be configured first (run `pwcli setup settings`) + +--- + +For more information, visit the repository or run commands interactively with `pwcli` + diff --git a/src/cli.ts b/src/cli.ts index c67e723..69e75e0 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,4 +1,6 @@ const { build } = require('gluegun'); +const fs = require('fs'); +const path = require('path'); /** * Create the cli and kick it off @@ -19,7 +21,32 @@ async function run(argv) { hidden: false, dashed: true, run: (toolbox) => { - toolbox.print.info('This is the help'); + // Try to read and display the help markdown file + try { + // When compiled, __dirname is build/commands + // Help file is in docs/ at repo root + const helpPath = path.join(__dirname, '../docs/help.md'); + + if (fs.existsSync(helpPath)) { + const helpContent = fs.readFileSync(helpPath, 'utf8'); + toolbox.print.info(helpContent); + } else { + // Fallback if help file not found + toolbox.print.info('pwcli - Photowall CLI'); + toolbox.print.info(''); + toolbox.print.info('Run "pwcli" to start the interactive menu.'); + toolbox.print.info(''); + toolbox.print.info( + 'For detailed help, see docs/help.md in the repository.', + ); + } + } catch (error) { + toolbox.print.error( + 'Error loading help documentation: ' + error.message, + ); + toolbox.print.info(''); + toolbox.print.info('Run "pwcli" to start the interactive menu.'); + } }, }) // provides default for help, h, --help, -h // .version() // provides default for version, v, --version, -v