Skip to content

mirchaemanuel/a80-cli

Repository files navigation

A80-cli GitHub Logo

A80-cli

A80-cli is a simple PHP CLI app in which I will collect the tools that I commonly use for my work and that I currently have in some private repositories or in personal workspace.

I'm going to collect (and convert) all my tools in this small application written

with Laravel Zero.

It is currently in the preliminary stage.

In addition to the usual tools, I will add new ones to interact with OpenAI and more.

Work progress

In this phase I am preparing the project in Laravel-Zero to accommodate the various tools.

I had the opportunity to experiment with different aspects of this fantastic project by Nuno Maduro and I find it fantastic and fit for purpose.

Coming soon

  • scripts/tools that I currently use to manipulate and collect my photos
  • report generators
  • web tools
    • crawler and scraper
    • sitemap generator
  • ...

OpenAI

Currently there is some command to interact with OpenAI

  • ai:query => allow the user to ask question to OpenAI
  • ai:title-abstract => generate a SEO title and an abstract from a text file (plain text only)
  • ai:image => generate an image from a prompt with the help of OpenAI
  • ai:audio-to-text => transcribe an audio/video file to text in many languages with the help of OpenAI
./a80 ai:query --help

Description:
  place a question to OpenAI (using da-vinci)

Usage:
  ai:query [options] [--] [<question>]

Arguments:
  question                       question to ask

Options:
  -m, --max-tokens[=MAX-TOKENS]  [1-4000] default is 2000
  
./a80 ai:title-abstract --help                                                                             ─╯
Description:
  Generate a title and description from a text file

Usage:
  ai:title-abstract [options] [--] <filename>

Arguments:
  filename                       file to read

Options:
  -m, --max-tokens[=MAX-TOKENS]  [1-4000] default is 2000
      --model[=MODEL]            [davinci, ada, babbage, curie, content-filter-alpha-c4] default is davinci

Requirements

  • PHP 8.1+
  • Imagick or GD extension for image processing
  • SQLite extension for database
  • Yaml parser (suggested)

Check requirements

You can execute a command to check requirement:

./a80 check

Checking system preconditions and requirements...
 - creating app settings path: /home/user/.a80_cli/: ✔
 - .env file: ✔
 - yaml extension: ✔
 - imagick extension: ✔
 - GD extension: ✔
 - sqlite extension: ✔

If you don't meet the requirements

If your development environment doesn't meet the requirements, you can use my Docker-based environment:

https://github.com/mirchaemanuel/ryuudev

Contains everything needed to develop and run a80-cli.

Usage

Installing composer dependencies

composer install

or

docker run --rm --interactive --tty --volume $PWD:/app composer install --ignore-platform-reqs

Build

You can build the application

php a80 app:build

It will create a phar executable archive in /builds

Release History

Release Date Notes
0.1 2023-01-14
  • Initial release
  • OpenAI client library
  • ai:query
0.1.3 2023-01-14
  • tools:image:thumb
0.1.4 2023-01-14
  • tools:image:list
0.1.5 2023-01-14
  • tools:image:list improved with thumbnail generation and report
0.1.6 2023-01-15
  • OpenAIService
  • ai:title:abstract generate title and abstract of text file
0.1.7 2023-01-20
  • added VERSION.yml
  • introduced Storage disk 'app' for local storage of preferences, data and cache
  • added two new commands: check and env:create
  • added database support for local storage
  • created settings table
0.1.8 2023-01-23
  • added ServiceProvider: AIServiceProvider and ImageServiceProvider
  • added GD failover for image processing when Imagick is not available
0.1.9 2023-02-07
  • fixed ImageUtils reference error
  • added some useful warning to tools:image:list command
  • converted VERSION.yml to JSON format for better compatibility
  • added new commands: tools:yaml2json and tools:json2yaml
0.2 2023-02-10
  • Introduced `Intervention Image` library for image processing
  • Refactoring ImageService
  • Added new command: tools:image:exif to read EXIF data from image file
0.3 2023-03-04
  • Added new command: `ai:image` to generate image file from prompt with OpenAI
  • Added new command: `ai:audio-to-text` to generate text from audio file with OpenAI
0.3.1 2023-03-05
  • [bug] image exif - Resolve issue with reading EXIF metadata from some images
  • [bug] ai audio2text: resolve audio file access from inside the phar
  • renamed `audio-to-text` to `audio2text`