create-rua-ext
v0.4.9
Published
CLI tool to create Rua extension templates
Downloads
505
Maintainers
Readme
create-rua-ext
CLI tool to scaffold Rua extension projects with support for various build tools and UI frameworks.
Features
- 🎯 Template-based generation - Each file is a separate template for easy maintenance
- 🚀 Multiple frameworks - React, Vue, Svelte, or vanilla JS
- ⚡ Vite integration - Fast development with HMR
- 🎨 Styling options - None, Tailwind CSS, or shadcn/ui
- 🔧 Flexible permissions - Choose only the APIs you need
- 📦 Package manager choice - npm, bun, pnpm, or yarn
- 🛠️ Modern tooling - TypeScript, ESM, and latest dependencies
Usage
# With bun
bunx create-rua-ext
# With npm/npx
npx create-rua-ext
# With extension name
bunx create-rua-ext my-awesome-extensionInteractive Prompts
The CLI will ask you for:
- Extension name - Display name for your extension
- Description - Short description
- Author - Your name (used in extension ID)
- Template:
- Basic (No Build) - Simple vanilla JS/HTML extension
- View Extension - Extension with UI framework and build tool
- Command Extension - Command-only actions (no UI)
- Build Tool (for View/Command templates):
- Vite - Fast build tool with HMR
- None - No build tool (vanilla JS)
- UI Framework (when using Vite):
- None (Vanilla) - Plain HTML/JS
- React - React with TypeScript
- Vue - Vue 3 with TypeScript
- Svelte - Svelte with TypeScript
- Package Manager (when using Vite):
- npm / bun / pnpm / yarn
- Styling (when using Vite for UI extensions):
- None - No CSS framework
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Tailwind + shadcn/ui components
- Permissions:
clipboard- Read/write clipboardnotification- Show system notificationsstorage- Local storage accesshttp- Make HTTP requestsshell- Execute shell commands
Generated Structure
Basic Template (No Build)
my-extension/
├── manifest.json
├── index.html
├── init.js
└── README.mdVite + React Template
my-extension/
├── manifest.json
├── package.json
├── vite.config.ts
├── tsconfig.json
├── index.html
├── src/
│ ├── main.ts
│ ├── App.tsx
│ ├── init.ts
│ └── style.css
└── README.mdVite + React + shadcn/ui Template
my-extension/
├── manifest.json
├── package.json
├── vite.config.ts
├── tsconfig.json
├── tailwind.config.ts
├── postcss.config.ts
├── components.json
├── index.html
├── src/
│ ├── main.ts
│ ├── App.tsx
│ ├── init.ts
│ ├── style.css
│ └── lib/
│ └── utils.ts
└── README.mdCommand Template
my-extension/
├── manifest.json
├── package.json
├── src/
│ └── init.ts
├── commands/
│ └── run.js
└── README.mdUsing rua-api
All templates include rua-api for extension functionality. The API is initialized automatically:
import { initializeRuaAPI } from "rua-api/browser";
// Initialize the API (extension info fetched from host)
const rua = await initializeRuaAPI();
// Use extension APIs
await rua.clipboard.writeText("Hello!");
await rua.notification.show({ title: "Hello!", body: "From extension" });
await rua.storage.set("key", "value");
await rua.ui.close();
// Register dynamic actions
await rua.actions.register([
{
id: "my-action",
name: "My Action",
mode: "view",
keywords: ["hello"],
},
]);Example
$ bunx create-rua-ext
🧩 Create Rua Extension
✔ Extension name: … My Extension
✔ Description: … A cool extension for Rua
✔ Author: … john
✔ Template: › View Extension
✔ Build tool: › Vite
✔ UI Framework: › React
✔ Package manager: › bun
✔ Styling: › shadcn/ui
✔ Permissions: › storage, notification
Creating extension in /path/to/my-extension...
✓ Extension created successfully!
Next steps:
cd my-extension
bun install
npx shadcn@latest add button card badge separator
bun devTemplate System
Templates are stored in src/templates/ and use Handlebars for variable substitution:
manifest.json.template- Extension manifestpackage.json.template- Package configurationvite.config.ts.template- Vite configurationsrc/App.tsx.template- React component templatesrc/App.vue.template- Vue component templatesrc/App.svelte.template- Svelte component templatesrc/init.ts.template- Extension initializationsrc/style.css.template- Base stylesREADME.md.template- Project documentation
Each template receives a context object with configuration flags and values.
Development
# Install dependencies
bun install
# Build the CLI (includes copying templates)
bun run build
# Run in development
bun run dev
# Test template generation
node test-template.js