lama2

command module
v1.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: AGPL-3.0 Imports: 1 Imported by: 0

README

Lama2: Plain-Text Powered REST API Client

Note The frontend part of the Lama2 project lives in Lama2Code. The extension tends to be updated along with the Lama2 core in this repo.

About

Lama2 is a Plain-Text powered REST API client & manager built for serious engineering teams. Lama2 specifies the .l2 syntax for describing APIs, and implements a CLI to execute .l2 files. Engineers collaborate on .l2 files using version control. Lama2 integrates nicely with IDEs and text-editors as well. Think of Lama2 as Markdown for APIs.

Benefits

  1. Plain-Text files: Store APIs in the Plain-Text .l2 API files. Simple and human-friendly syntax. Learn basics within minutes!
  2. Simple CLI: Launch the CLI tool l2 on API files to make REST API requests.
  3. Editor support: Invoke Lama2 from your favorite text editor or IDE. Helpful documentation and tool support to build editor extensions included.
  4. Longevity & track-ability: Commit .l2 files to git or other version control for long life & change tracking.
  5. Collaboration: Share API repo with teammates and colleagues to collaborate
  6. Code generation: Convert l2 API definitions into your preferred language/library, be it Python, Javascript, Java or many other options.
  7. Powerful chaining: Chain multiple l2 requests through embedded Javascript blocks
  8. Documentation: Explore examples, how-tos, explanations, references, FAQ/RAQs, and diagrams. Documentation is a priority, so that you never have to get lost.
  9. Extensibility: .l2 syntax is implemented as a recursive descent parser, based on a formal grammar. Dig into details and implement new syntax (ex: to support websockets)

💡 Coming from Postman? Let Lama2 help you convert Postman data dumps into a nice Plain-Text Lama2 repo.

Terminal Demo: A POST request

VSCode Demo: The same POST request

Installation/Update

For Linux/MacOS systems, run the following command to either install or update Lama2:

curl -s https://hexmos.com/lama2/install.sh | bash -s

For Windows systems, run the following command on powershell as an Administrator to either install or update Lama2:

choco install lama2 --version=1.0.0 --force -y

Learn more about other installation methods from our docs.

(Optional) Import your collections from Postman

Follow guide to import your existing Postman collections into a Plain-Text Lama2 repository.

Self update

An easier way to update the binary for Linux/MacOS to latest release is through:

l2 -u
VSCode Extension

Find Lama2 for VSCode at the VSCode Marketplace. The extension requires the l2 command available (usually at /usr/local/bin/l2).

Design Philosophy

Lama2 takes inspiration from Markdown. Think of our approach as Markdown for APIs.

In particular, we strive to:

  1. Delegate subtasks to mature and preferably open tools:
    1. API Collaboration - git
    2. API Organization - OS file system + IDEs
    3. API Editing - VSCode/IDEs
    4. API Requests - HTTPie (httpie-go, to be specific)
    5. Request Chaining - Embedded Javascript
  2. Start a language formalization effort from the beginning (learning from Markdown history)
  3. Keep language syntax simple
  4. Invest into good documentation; however, ensure users can perform competently without referencing documentation as much as possible.
  5. Strive to keep components decoupled

Community and Support

  1. Full documentation @hexmos.com/lama2
  2. Report issues and propose improvements at Github issues
  3. Discuss with the community at Discord and Github Discussions

Acknowledgements

  1. The excellent VSCode ecosystem helping us develop our VSCode extension
  2. httpie-go: A golang version of httpie which we have forked and integrated with Lama2. Source
  3. httpsnippet: A HAR Request to multi-language converter; we use a custom fork of httpsnippet for code generation from l2 files.
  4. goja: A pure golang based JS interpreter with great, correct implementation of ECMA5. We use goja for JS processor blocks in multi-stage API files.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package `cmdexec` provides a facility to execute l2 commands, stream output to stdout, while also providing ability to retrieve the command output as a string.
Package `cmdexec` provides a facility to execute l2 commands, stream output to stdout, while also providing ability to retrieve the command output as a string.
Package `cmdgen` provides an API to generate API request commands (by default based on HTTPie) based on the parsed API file contents and the `l2` command invocation parameters
Package `cmdgen` provides an API to generate API request commands (by default based on HTTPie) based on the parsed API file contents and the `l2` command invocation parameters
Package controller coordinates all the other components in the `Lama2` project.
Package controller coordinates all the other components in the `Lama2` project.
Package `import` helps d, rIDevelopers switch to Lama2 from various popular tools.
Package `import` helps d, rIDevelopers switch to Lama2 from various popular tools.
Package `lama2cmd` provides CLI argument parsing facilities.
Package `lama2cmd` provides CLI argument parsing facilities.
Package `outputmanager` provides facilities for controlling the logging library as well as capabilities to post-process API execution results (such as store results as a JSON file)
Package `outputmanager` provides facilities for controlling the logging library as well as capabilities to post-process API execution results (such as store results as a JSON file)
The `parser` package provides primitives that help with writing recursive descent parsers.
The `parser` package provides primitives that help with writing recursive descent parsers.
Package preprocess provides facilities to expand environment variables in `.l2` API files and return the contents
Package preprocess provides facilities to expand environment variables in `.l2` API files and return the contents
tests
Package `utils` provides useful functions for simplifying various programming tasks
Package `utils` provides useful functions for simplifying various programming tasks

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL