robin-cli-monorepo
v0.1.0
Published
Monorepo for Robin CLI tools.
Readme
Robin CLI Tools Monorepo
Welcome to the central repository for all official Robin Command Line Interface (CLI) tools. This monorepo is designed to streamline development, testing, and deployment of our various CLI utilities.
Overview
This repository contains a suite of tools aimed at managing your Robin common resources and utilities. Each tool is developed as a separate package within this monorepo to ensure modularity and maintainability.
Monorepo Structure
This monorepo is managed using [Specify your monorepo tool, e.g., Lerna, Nx, Turborepo, Yarn Workspaces, pnpm workspaces, or just "npm/yarn/pnpm workspaces" if using built-in features]. The general structure is as follows:
/
├── packages/
│ ├── robin-tool-alpha/ # Source code for 'robin-tool-alpha'
│ │ ├── src/
│ │ ├── package.json
│ │ └── README.md # Tool-specific README
│ ├── robin-tool-beta/ # Source code for 'robin-tool-beta'
│ │ ├── src/
│ │ ├── package.json
│ │ └── README.md
│ └── ... # Other tools
├── scripts/ # Shared scripts for building, testing, etc.
├── .gitignore
├── package.json # Root package.json
├── README.md # This file
└── [other_config_files.json] # e.g., lerna.json, nx.json, tsconfig.base.jsonIncluded Tools
Below is a list of the CLI tools currently available in this monorepo. For more detailed information on a specific tool, please refer to its individual README.md file within its package directory. If you build a tool, please update this list:
- robin-prompts-cli: Generative AI prompts generation
More tools will be listed here as they are developed.
Getting Started
Prerequisites Node.js and pnpm
Installation
Clone the repository:
git clone https://your-repository-url/robin-cli-tools.git
cd robin-cli-toolsInstall dependencies:
Depending on your package manager and monorepo tool:
If using pnpm workspaces
pnpm install
Usage
Each tool can typically be invoked using its package name. The exact method might depend on how your monorepo and tools are set up (e.g., symlinking, global installation during development).
For detailed usage instructions, options, and examples for each specific tool, please consult its dedicated README.md file located in its respective packages// directory.
Development
This section provides guidelines for developers working on or contributing to this monorepo.
Setting up a Local Development Environment
Ensure you have the prerequisites installed (Node.js, pnpm, Git).
Follow the Installation steps above.
Running Scripts
Run a script in all packages:
pnpm -r <script-name>Example: pnpm -r test (runs the test script in every package)
Example: pnpm -r build
Run a script in a specific package:
pnpm --filter <package-name> <script-name>Example: pnpm --filter @androbinco/prompts-cli test
Example: pnpm --filter @androbinco/prompts-cli dev (if a dev script is defined)
Linting and Formatting
(If you set up ESLint/Prettier at the root level later)
pnpm -r lint
pnpm -r format
Adding a New Tool / Package
Follow these steps to add a new CLI tool to this monorepo:
Choose a Package Name -Decide on a clear, descriptive name for your new tool. -If you plan to publish it to npm under a scope, the name will be like @your-scope/your-tool-name (e.g., @androbinco/new-robin-tool). -The directory name under packages/ should ideally match the tool name (e.g., new-robin-tool).
Create the Package Directory:
- mkdir packages/your-new-tool-name
- cd packages/your-new-tool-name
Initialize package.json:
- You can create it manually or run pnpm init (or npm init -y and then adapt it).
Example packages/your-new-tool-name/package.json:
{
"name": "@your-scope/your-new-tool-name", // Or just "your-new-tool-name" if not scoped
"version": "0.1.0",
"description": "A brief description of what your new CLI tool does.",
"type": "module", // Recommended for modern Node.js projects
"main": "./src/index.js", // Entry point of your tool's logic
"bin": {
"your-new-tool-command": "./src/index.js" // The command users will type
},
"files": [ // Files to include when publishing to npm
"src/",
"README.md",
"LICENSE" // If you have one
],
"scripts": {
"start": "node ./src/index.js",
"dev": "node ./src/index.js", // Consider using nodemon for auto-restarts
"test": "echo \"Error: no test specified for your-new-tool-name\" && exit 1", // TODO: Add real tests
"build": "echo \"your-new-tool-name: No build step required.\"_ // Or your actual build command
"lint": "echo \"your-new-tool-name: Lint not configured.\"" // TODO: Configure linting
},
"keywords": ["cli", "robin", "your-tool-keyword"],
"author": "Your Name / Team Name",
"license": "MIT", // Or your chosen license
"dependencies": {
// Add runtime dependencies here, e.g., "inquirer": "^8.0.0"
},
"devDependencies": {
// Add development dependencies here, e.g., "nodemon": "^3.0.0"
}
}Key fields to customize: name, version, description, main, bin (define your command name), files, scripts, keywords, author, license.
bin: This is crucial. It maps the command-line name to your executable script.
files: Important for publishing to ensure only necessary files are included.
Create Source Directory and Entry File:
- mkdir src
- touch src/index.js
Add a basic shebang and starting code to src/index.js:
#!/usr/bin/env node
// src/index.js
// If using ES Modules ("type": "module" in package.json)
// import someDependency from 'some-dependency';
// If using CommonJS (remove "type": "module" or set to "commonjs")
// const someDependency = require('some-dependency');
function main() {
console.log("Hello from your-new-tool-command!");
// Your CLI logic here
// Parse arguments (e.g., using process.argv or a library like yargs, commander)
// Implement features
}
main();Make src/index.js executable: chmod +x src/index.js (especially important if not using Windows).
Write a README.md for Your Tool:
Create packages/your-new-tool-name/README.md with:
- Tool name and description.
- Installation instructions (if it can be installed standalone).
- Detailed usage, commands, and options.
- Examples.
Install Dependencies (if any):
- From within packages/your-new-tool-name/:
pnpm add some-dependency pnpm add -D some-dev-dependencyLink the New Package in the Monorepo:
- Go back to the monorepo root directory:
cd ../.. pnpm installThis command will recognize the new package (because pnpm-workspace.yaml points to packages/*) and link it into the workspace. The binary defined in your new tool's bin field should now be available in the root node_modules/.bin/ and runnable from the root.
Update Root README.md:
- Add your new tool to the "Included Tools" list in this main README.md file.
- Add any relevant root-level scripts to the root package.json if needed (e.g., pnpm --filter @your-scope/your-new-tool-name dev).
- Implement Your Tool's Logic:
- Flesh out src/index.js and any other modules.
Good Practices:
- Focused Functionality: Each tool should have a clear, specific purpose.
- Argument Parsing: Use a library like yargs or commander for robust argument parsing and help messages.
- Error Handling: Implement proper error handling and provide clear error messages.
- Modularity: Break down code into reusable modules/functions.
- Asynchronous Operations: Use async/await for I/O operations.
- Testing: Write unit and integration tests.
- Documentation: Keep both the code and the tool's README.md well-documented.
