npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nls-cli

v1.0.1

Published

Natural Language Shell - Natural language approach to using the shell

Downloads

4

Readme

📍 Overview

The Natural Language Shell (NLS) project is a Node.js-based tool designed to interpret and execute natural language commands as shell commands. Leveraging OpenAIs GPT-4 model, NLS translates user inputs into executable instructions, providing a seamless and intuitive command-line interface. The project ensures stability and reproducibility through strict dependency management and TypeScript configuration. By integrating AI-powered functionalities and robust command-line operations, NLS enhances user interaction and automates tasks efficiently, making it a valuable asset for developers seeking to streamline their workflows with natural language processing capabilities.


👾 Features

| | Feature | Description | |----|-------------------|---------------------------------------------------------------| | ⚙️ | Architecture | The project follows a modular architecture with distinct components for CLI, AI integration, and shell command execution. | | 🔩 | Code Quality | The codebase uses TypeScript, ensuring type safety and maintainability. The structure is clean with well-defined modules. | | 📄 | Documentation | Documentation is present in the form of comments within the code. However, there is no mention of external documentation or README files. | | 🔌 | Integrations | Integrates with OpenAI's GPT-4 model for natural language processing and uses dotenv for environment variable management. | | 🧩 | Modularity | Highly modular with separate files for CLI, AI, shell execution, and configuration, promoting reusability and maintainability. | | 🧪 | Testing | No specific testing frameworks or tools mentioned. Testing practices are not detailed in the provided information. | | ⚡️ | Performance | Performance is optimized for asynchronous shell command execution and efficient handling of AI responses. | | 🛡️ | Security | Uses dotenv for secure management of environment variables, ensuring sensitive data like API keys are protected. | | 📦 | Dependencies | Key dependencies include TypeScript, @types/node, ts-node, OpenAI, dotenv, and various npm packages for managing the project. | | 🚀 | Scalability | The architecture supports scalability by separating concerns into different modules, allowing for easier scaling and maintenance. |


📂 Repository Structure

└── nls/
    ├── package-lock.json
    ├── package.json
    ├── src
    │   ├── ai.ts
    │   ├── cli.ts
    │   ├── config.ts
    │   ├── index.ts
    │   └── shell.ts
    └── tsconfig.json

🧩 Modules

| File | Summary | | --- | --- | | package-lock.json | Summary of package-lock.jsonThe package-lock.json file in the nls repository serves as a critical component for managing the projects dependencies. It ensures that the exact versions of the packages used during development are locked down, providing consistency across different environments. This file is automatically generated and updated by npm, reflecting the entire dependency tree, including nested dependencies. By doing so, it guarantees that the project remains stable and reproducible, preventing potential issues caused by version discrepancies. This is particularly important in the context of the nls repository, which appears to be a Node.js-based project with various modules under the src directory, such as ai.ts, cli.ts, config.ts, index.ts, and shell.ts. | | package.json | Define the projects metadata and dependencies, facilitating the build and execution of the Natural Language Shell (NLS) tool. Enable TypeScript compilation, script execution, and package management, ensuring seamless integration with AI-powered functionalities and command-line operations. | | tsconfig.json | Configure TypeScript compiler options to ensure compatibility with ES2016, enable CommonJS module generation, enforce strict type-checking, and facilitate interoperability with CommonJS modules. Specify output directory for emitted files and skip type checking for declaration files to streamline the build process. |

| File | Summary | | --- | --- | | cli.ts | Facilitates user interaction by interpreting natural language commands and executing corresponding shell commands. Integrates command interpretation and execution functionalities, providing a user-friendly interface for command-line operations within the repositorys architecture. | | shell.ts | Facilitates the execution of shell commands asynchronously, providing a promise-based interface for handling command output and errors. Integrates seamlessly within the repositorys architecture to support various functionalities requiring command-line interactions, enhancing the overall capability of the system to perform automated tasks and operations. | | ai.ts | Interpret natural language commands by leveraging OpenAIs GPT-4 model to generate corresponding shell commands, enhancing the repositorys functionality for translating user inputs into executable shell instructions. | | index.ts | Initialize the command-line interface by capturing user arguments and invoking the runCLI function. Handle any unhandled errors by logging them and exiting the process. This entry point integrates various components of the repository, facilitating user interaction through the CLI. | | config.ts | Configure the OpenAI client by loading environment variables using dotenv, enabling secure access to the OpenAI API within the repositorys architecture. |


🚀 Getting Started

🔖 Prerequisites

TypeScript: version x.y.z

📦 Installation

Build the project from source:

  1. Clone the nls repository:
❯ git clone /Users/rama2r/nls
  1. Navigate to the project directory:
❯ cd nls
  1. Install the required dependencies:
❯ npm install

🤖 Usage

To run the project, execute the following command:

❯ npm run build && node dist/index.js

🧪 Tests

Execute the test suite using the following command:

❯ npm test

📌 Project Roadmap

  • [X] Task 1: Implement feature one.
  • [ ] Task 2: Implement feature two.
  • [ ] Task 3: Implement feature three.

🤝 Contributing

Contributions are welcome! Here are several ways you can contribute:

  1. Fork the Repository: Start by forking the project repository to your LOCAL account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone /Users/rama2r/nls
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to LOCAL: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!

🎗 License

This project is protected under the SELECT-A-LICENSE License. For more details, refer to the LICENSE file.


🙌 Acknowledgments

  • List any resources, contributors, inspiration, etc. here.