@airuleshub/cli 1.0.0 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,26 @@
1
1
  # @airuleshub/cli
2
2
 
3
- The official CLI tool for [Airuleshub](https://airuleshub.com) - The ultimate destination to find, share, and manage AI rules and instructions.
3
+ **The CLI for AI-Native Development.**
4
4
 
5
- Easily fetch and install AI rules directly into your project with a single command.
5
+ Fetch, manage, and share **Cursor Rules**, **Windsurf Instructions**, and **Copilot Guidelines** effortlessly.
6
+
7
+ [![License: ISC](https://img.shields.io/badge/License-ISC-yellow.svg?style=flat-square)](https://opensource.org/licenses/ISC)
8
+
9
+ ---
10
+
11
+ ## šŸ“š Table of Contents
12
+
13
+ - [Features](#-features)
14
+ - [Installation](#-installation)
15
+ - [Usage](#-usage)
16
+ - [Install Rules](#install-a-rule)
17
+ - [Interactive Mode](#interactive-mode)
18
+ - [About AI Rules Hub](#-about-airuleshub)
19
+ - [License](#-license)
20
+
21
+ ## 🌟 Introduction
22
+
23
+ **@airuleshub/cli** connects your local development environment with the vast library of rules available on [airuleshub.com](https://airuleshub.com). Whether you are starting a new **Next.js** project, setting up a **React Native** app, or configuring **Supabase**, proper context is key for AI coding assistants. This CLI makes it instant.
6
24
 
7
25
  ## šŸš€ Installation
8
26
 
@@ -20,11 +38,11 @@ npx @airuleshub/cli install <rule-slug>
20
38
  npm install -g @airuleshub/cli
21
39
  ```
22
40
 
23
- ## šŸ“– Usage
41
+ ## ļæ½ Usage
24
42
 
25
43
  ### Install a Rule
26
44
 
27
- To install a rule, simply run the `install` command followed by the rule's slug (ID).
45
+ The primary command is `install`. It fetches the rule content and saves it to your project.
28
46
 
29
47
  ```bash
30
48
  airuleshub install <rule-slug>
@@ -38,22 +56,40 @@ airuleshub install nextjs-app-router-cursor-rules
38
56
 
39
57
  ### Options
40
58
 
41
- - **Format Selection**: The CLI will ask you to choose the file format (`.md` or `.txt`) if not specified.
42
- - **Overwrite Protection**: Warns you if the file already exists before overwriting.
59
+ - **Format Selection (`-f, --format`)**: Choose between `.md` (Markdown) or `.txt` (Text).
60
+ - **Overwrite Protection**: Safely checks if the file already exists before overwriting.
61
+
62
+ ### Interactive Mode
63
+
64
+ You can also run the command without flags to use the interactive prompts:
65
+
66
+ ```bash
67
+ npx @airuleshub/cli install <rule-slug>
68
+ # ā“ Choose file format: Markdown (.md)
69
+ # ā“ File already exists. Overwrite? (y/N)
70
+ ```
71
+
72
+ ## ā“ Why use this?
73
+
74
+ Standardizing your AI context is critical for team consistency. Instead of copy-pasting `.cursorrules` files or prompts, use this CLI to pull the latest, verified versions.
43
75
 
44
76
  ## šŸ› ļø Features
45
77
 
46
- - ⚔ **Fast & Easy**: Install rules in seconds.
47
- - šŸ“‚ **Multi-format Support**: Save rules as Markdown or Text files.
48
- - šŸ¤– **Interactive**: User-friendly prompts for configuration.
49
- - šŸ”„ **Always Up-to-Date**: Fetches the latest version of the rule from Airuleshub.
78
+ - ⚔ **Instant Setup**: Initialize Cursor rules in seconds without manual copy-pasting.
79
+ - šŸ“‚ **Multi-Format Support**: Generate rules in `.md` (Markdown) or `.txt` formats compatible with various AI editors.
80
+ - šŸ¤– **AI-Ready**: Optimized for Cursor, Windsurf, GitHub Copilot, and other AI coding assistants.
81
+ - šŸ”„ **Always Current**: Fetch the latest community-verified rules directly from the AI Rules Hub registry.
82
+ - šŸ› ļø **Developer Friendly**: Simple, intuitive CLI interface designed for modern web development workflows (Next.js, TypeScript, etc.).
50
83
 
51
84
  ## šŸ‘¤ Author & Community
52
85
 
53
86
  Built with ā¤ļø by **Nikunj Borad**.
54
87
 
55
- - **GitHub**: [@nikunjborad123](https://github.com/nikunjborad123)
88
+ Connect with the developer and the community:
89
+
90
+ - šŸ™ **GitHub**: [@nikunjborad123](https://github.com/nikunjborad123)
91
+ - 🌐 **Website**: [AI Rules Hub.com](https://airuleshub.com)
56
92
 
57
93
  ## šŸ“„ License
58
94
 
59
- This project is licensed under the ISC License.
95
+ This project is licensed under the [ISC License](https://opensource.org/licenses/ISC).
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { installRule } from "../src/commands/install.js";
4
+ const program = new Command();
5
+ program.name("airuleshub").description("Install AI rules from airuleshub.com");
6
+ program
7
+ .command("install <slug>")
8
+ .option("-f, --format <type>", "md or txt")
9
+ .action(installRule);
10
+ program.parse();
@@ -0,0 +1,8 @@
1
+ export async function fetchRule(slug) {
2
+ const BASE_URL = process.env.VITE_APP_URL || 'https://airuleshub.com';
3
+ const res = await fetch(`${BASE_URL}/api/rules/${slug}`);
4
+ if (!res.ok) {
5
+ throw new Error('Rule not found');
6
+ }
7
+ return res.json();
8
+ }
@@ -0,0 +1,47 @@
1
+ import fs from 'fs-extra';
2
+ import inquirer from 'inquirer';
3
+ import { fetchRule } from '../api/rules.js';
4
+ import { writeRule, getRulePath } from '../fs/writer.js';
5
+ export async function installRule(slug, options) {
6
+ try {
7
+ console.log(`šŸ“¦ Installing rule: ${slug}`);
8
+ const rule = await fetchRule(slug);
9
+ const format = options.format
10
+ ? options.format
11
+ : (await inquirer.prompt([
12
+ {
13
+ type: 'list',
14
+ name: 'format',
15
+ message: 'šŸ“„ Choose file format:',
16
+ choices: [
17
+ { name: 'Markdown (.md)', value: 'md' },
18
+ { name: 'Text (.txt)', value: 'txt' },
19
+ ],
20
+ default: 'md',
21
+ },
22
+ ])).format;
23
+ const filePath = getRulePath(slug, format);
24
+ if (await fs.pathExists(filePath)) {
25
+ const { overwrite } = await inquirer.prompt([
26
+ {
27
+ type: 'confirm',
28
+ name: 'overwrite',
29
+ message: 'āš ļø File already exists. Overwrite?',
30
+ default: false,
31
+ },
32
+ ]);
33
+ if (!overwrite) {
34
+ console.log('āŒ Installation cancelled.');
35
+ return;
36
+ }
37
+ }
38
+ await writeRule(rule, format ?? 'md');
39
+ }
40
+ catch (error) {
41
+ if (error.message?.includes('User force closed the prompt')) {
42
+ console.log('\nāŒ Operation cancelled.');
43
+ process.exit(0);
44
+ }
45
+ throw error;
46
+ }
47
+ }
@@ -0,0 +1,14 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import { renderTemplate } from '../template.js';
4
+ export const RULES_DIR = 'airules';
5
+ export function getRulePath(slug, format) {
6
+ return path.join(process.cwd(), RULES_DIR, `${slug}.${format}`);
7
+ }
8
+ export async function writeRule(rule, format) {
9
+ const baseDir = path.join(process.cwd(), RULES_DIR);
10
+ await fs.ensureDir(baseDir);
11
+ const filePath = getRulePath(rule.slug, format);
12
+ await fs.writeFile(filePath, renderTemplate(rule));
13
+ console.log(`āœ… Installed: ${RULES_DIR}/${rule.slug}.${format}`);
14
+ }
@@ -0,0 +1,11 @@
1
+ export function renderTemplate(rule) {
2
+ return `
3
+ # ${rule.title}
4
+
5
+ Source: https://airuleshub.com/rules/${rule.slug}
6
+
7
+ ---
8
+
9
+ ${rule.content}
10
+ `.trim();
11
+ }
package/package.json CHANGED
@@ -1,21 +1,45 @@
1
1
  {
2
2
  "name": "@airuleshub/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "scripts": {
8
+ "build": "tsc",
9
+ "prepublishOnly": "npm run build",
8
10
  "test": "echo \"Error: no test specified\" && exit 1"
9
11
  },
10
12
  "bin": {
11
13
  "airuleshub": "./dist/bin/airuleshub.js"
12
14
  },
13
- "keywords": [],
15
+ "keywords": [
16
+ "ai",
17
+ "cli",
18
+ "rules",
19
+ "cursor",
20
+ "cursor-rules",
21
+ "windsurf",
22
+ "copilot",
23
+ "automation",
24
+ "scaffolding",
25
+ "productivity",
26
+ "developer-tools",
27
+ "airuleshub"
28
+ ],
14
29
  "files": [
15
30
  "bin",
16
31
  "dist"
17
32
  ],
18
- "author": "",
33
+ "author": "Nikunj Borad <boradnikunj2001@gmail.com> (https://github.com/nikunjborad123)",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/nikunjborad123/airuleshub.git",
37
+ "directory": "airuleshub-cli"
38
+ },
39
+ "homepage": "https://github.com/nikunjborad123/airuleshub/tree/master/airuleshub-cli#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/nikunjborad123/airuleshub/issues"
42
+ },
19
43
  "license": "ISC",
20
44
  "dependencies": {
21
45
  "commander": "^14.0.3",