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

openai-electron-cli

v1.1.1

Published

Command line tool to generate Electron application with OpenAI API

Downloads

12

Readme

OpenAI Electron

npm version node version size license

Command line tool to generate Electron application with OpenAI API

Demo

Installation

You can install this project by using NPM

npm install --global openai-electron-cli

You can check if the project installed properly and the version of the project

openai-electron --version

You can see all the avaiable commands

openai-electron -H

Windows User Issue

If you are Windows user and get error like this:

openai-electron : File C:\Users\xxxx\AppData\Roaming\npm\openai-electron.ps1 cannot be loaded because running scripts
is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ openai-electron
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

You can fix it by running this command (it may cause a security issue)

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

Command Usage

install

Installing all electron depencies that needed to run an Electron application

set-prompt

Set the prompt that will send to OpenAI to generate the source code. Example:

openai-electron set-prompt "write a simple blog in HTML with CSS"

get-prompt

Get the prompt that given by user. Example:

openai-electron get-prompt
# output:
# write a simple blog in HTML with CSS

generate-code

Generate the source code by sending the prompt to OpenAI API. You need to have OpenAI API Key. Recommend to read How to create OpenAI API keys. Example:

openai-electron generate-code --openai-key "sk-4EdVbFhGP..."
# output:
# ✅ Source code generated successfully
# ✅ Source code saved and application is ready to run

edit-code

View and edit the generated source code from OpenAI with text editor (default: vim). Example:

openai-electron edit-code --text-editor vim

Edit code

run

Run the generated source code as desktop application via electron

Electron App

run-webserver

Run the generated source code as Web application via HTTP server. Example:

openai-electron run-webserver
# output:
# ╭────────────────────────────────────────────────╮
# │                                                │
# │    Application run on http://localhost:5000    │
# │                                                │
# ╰────────────────────────────────────────────────╯

export

Export the generated source code as executable program via electron-forge. Example:

openai-electron export -o .
# output:
# ? What is your platform? Linux
# ✅ Application packaged successfully
tree -L 3 .
# output:
# .
# └── out
#     ├── electron_app-linux-x64
#     │   ├── LICENSE
#     │   ├── LICENSES.chromium.html
#     │   ├── chrome-sandbox
#     │   ├── chrome_100_percent.pak
#     │   ├── chrome_200_percent.pak
#     │   ├── crashpad_handler
#     │   ├── electron_app
#     │   ├── icudtl.dat
#     │   ├── libEGL.so
#     │   ├── libGLESv2.so
#     │   ├── libffmpeg.so
#     │   ├── libvk_swiftshader.so
#     │   ├── locales
#     │   ├── resources
#     │   ├── resources.pak
#     │   ├── snapshot_blob.bin
#     │   ├── swiftshader
#     │   ├── v8_context_snapshot.bin
#     │   ├── version
#     │   └── vk_swiftshader_icd.json
#     └── make
#         ├── electron-app_1.0.0_amd64.deb
#         └── electron_app-1.0.0.x86_64.rpm

# 6 directories, 19 files