Welcome to the nanoservice-ts CLI contribution guide! This document outlines the best practices for contributing to the CLI, ensuring consistency, usability, and maintainability.


Overview

The CLI (@nanoservice-ts/cli) is a core tool for managing workflows, nodes, and deployments. Contributions should focus on:
Enhancing Developer Experience – Commands should be intuitive and efficient.
Maintaining Consistency – Follow existing patterns and structures.
Ensuring Robustness – Proper error handling, validations, and tests are mandatory.


Getting Started

Make sure you follow the recommendations on how to set up local environment and steps to complete before committing your changes. To learn more visit

1. Setup the Development Environment

Clone the repository and navigate to the CLI package:

git clone https://github.com/deskree-inc/nanoservice-ts.git
cd packages/cli
npm install

2. CLI Structure

The CLI follows a modular command structure:

/packages/cli
 ├── /src
 │    ├── commands/  # Individual CLI commands
 │    ├── services/  # Utility services
 │    ├── index.ts   # CLI entry point
 │    ├── config.ts  # CLI configurations
 │    ├── logger.ts  # Logging utilities
 ├── /tests          # Unit tests for CLI commands
 ├── package.json    # CLI dependencies and scripts

Adding a New CLI Command

All commands should be placed inside /src/commands/ and registered in index.ts.

Coding Guidelines

1. Naming Conventions

  • Commands should use kebab-case (e.g., deploy-workflow, init-project).
  • Functions should use camelCase (e.g., fetchNodes()).
  • Files should use PascalCase.ts (e.g., ListNodes.ts).

2. Command Structure

Each command should include:
A clear description (.description()).
Error handling using try/catch.
Logging (logSuccess(), logError()).
Async execution (await where necessary).

3. Logging & Feedback

Use consistent logging to improve UX:

import { logSuccess, logError } from '../logger';
logSuccess('Action completed successfully!');
logError('Something went wrong!');

Submitting a Pull Request

1. Open a New Branch

Follow branch naming conventions:

git checkout -b feature/add-list-nodes

2. Ensure Code Quality

Run linting and formatting checks:

npm run lint
npm run format

3. Submit a PR

  • Provide a clear description of the change.
  • Reference any related issues.
  • Request a review from maintainers before merging.

Final Notes

Contributing to the nanoservice-ts CLI means helping developers build and deploy faster with nanoservices. We value clean, well-documented, and intuitive CLI tools. If you have any questions, feel free to open an issue! 🚀