@arafeymasood/rabot 0.0.0-stage → 2.0.2
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 +33 -2
- package/api/chat.ts +75 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/system.d.ts +8 -0
- package/dist/prompts/system.d.ts.map +1 -0
- package/dist/prompts/system.js +91 -0
- package/dist/prompts/system.js.map +1 -0
- package/dist/services/LLMService.d.ts +15 -0
- package/dist/services/LLMService.d.ts.map +1 -0
- package/dist/services/LLMService.js +64 -0
- package/dist/services/LLMService.js.map +1 -0
- package/dist/shell/RafeyShell.d.ts +16 -0
- package/dist/shell/RafeyShell.d.ts.map +1 -0
- package/dist/shell/RafeyShell.js +246 -0
- package/dist/shell/RafeyShell.js.map +1 -0
- package/package.json +58 -4
- package/vercel.json +10 -0
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```
|
|
4
|
+
╦═╗┌─┐┌─┐┌─┐┬ ┬ ╔═╗┬ ┬┌─┐┬ ┬
|
|
5
|
+
╠╦╝├─┤├┤ ├┤ └┬┘ ╚═╗├─┤├┤ │ │
|
|
6
|
+
╩╚═┴ ┴└ └─┘ ┴ ╚═╝┴ ┴└─┘┴─┘┴─┘
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
*Everything you need to know about Rafey*
|
|
10
|
+
|
|
11
|
+
[](https://www.npmjs.com/package/@arafeymasood/rabot)
|
|
12
|
+
[](https://nodejs.org)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## 🚀 Quick Start
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install globally
|
|
20
|
+
npm install -g @arafeymasood/rabot
|
|
21
|
+
|
|
22
|
+
# Start chatting
|
|
23
|
+
rabot
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 💬 Usage
|
|
27
|
+
|
|
28
|
+
| Command | Description |
|
|
29
|
+
|---------|-------------|
|
|
30
|
+
| `<message>` | Chat with AI assistant |
|
|
31
|
+
| `/help` | Show available commands |
|
|
32
|
+
| `/clear` | Clear the terminal |
|
|
33
|
+
| `/history` | View recent conversations |
|
|
34
|
+
| `/exit` | Exit the shell |
|
package/api/chat.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
2
|
+
|
|
3
|
+
export const config = {
|
|
4
|
+
runtime: 'edge',
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
interface ChatRequest {
|
|
8
|
+
prompt: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default async function handler(request: Request) {
|
|
12
|
+
// CORS headers
|
|
13
|
+
const headers = {
|
|
14
|
+
'Access-Control-Allow-Origin': '*',
|
|
15
|
+
'Access-Control-Allow-Methods': 'POST, OPTIONS',
|
|
16
|
+
'Access-Control-Allow-Headers': 'Content-Type',
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Handle preflight
|
|
21
|
+
if (request.method === 'OPTIONS') {
|
|
22
|
+
return new Response(null, { status: 200, headers });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (request.method !== 'POST') {
|
|
26
|
+
return new Response(JSON.stringify({ error: 'Method not allowed' }), {
|
|
27
|
+
status: 405,
|
|
28
|
+
headers,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
const body: ChatRequest = await request.json();
|
|
34
|
+
const { prompt } = body;
|
|
35
|
+
|
|
36
|
+
if (!prompt) {
|
|
37
|
+
return new Response(JSON.stringify({ error: 'Prompt is required' }), {
|
|
38
|
+
status: 400,
|
|
39
|
+
headers,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Use environment variable from Vercel
|
|
44
|
+
const apiKey = process.env.GEMINI_API_KEY;
|
|
45
|
+
if (!apiKey) {
|
|
46
|
+
return new Response(JSON.stringify({ error: 'API key not configured on server' }), {
|
|
47
|
+
status: 500,
|
|
48
|
+
headers,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const genAI = new GoogleGenerativeAI(apiKey);
|
|
53
|
+
const model = genAI.getGenerativeModel({
|
|
54
|
+
model: process.env.GEMINI_MODEL || 'gemini-3.8-flash'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const result = await model.generateContent(prompt);
|
|
58
|
+
const response = await result.response;
|
|
59
|
+
const text = response.text();
|
|
60
|
+
|
|
61
|
+
return new Response(JSON.stringify({ response: text }), {
|
|
62
|
+
status: 200,
|
|
63
|
+
headers,
|
|
64
|
+
});
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error('Error in chat API:', error);
|
|
67
|
+
return new Response(JSON.stringify({
|
|
68
|
+
error: 'Failed to generate response',
|
|
69
|
+
details: error instanceof Error ? error.message : 'Unknown error'
|
|
70
|
+
}), {
|
|
71
|
+
status: 500,
|
|
72
|
+
headers,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
+
dotenv_1.default.config({ path: '.env.local' });
|
|
9
|
+
const commander_1 = require("commander");
|
|
10
|
+
const RafeyShell_1 = require("./shell/RafeyShell");
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
const program = new commander_1.Command();
|
|
13
|
+
program
|
|
14
|
+
.name('rabot')
|
|
15
|
+
.description('AI-powered shell with personalized LLM assistance')
|
|
16
|
+
.version('1.0.0');
|
|
17
|
+
program
|
|
18
|
+
.command('start')
|
|
19
|
+
.description('Start the interactive shell')
|
|
20
|
+
.option('-m, --model <model>', 'LLM model to use', 'gemini-3.8-flash')
|
|
21
|
+
.action(async (options) => {
|
|
22
|
+
try {
|
|
23
|
+
const shell = new RafeyShell_1.RafeyShell(options.model);
|
|
24
|
+
await shell.start();
|
|
25
|
+
// Keep the process alive - readline will handle the event loop
|
|
26
|
+
// The process will exit when readline closes (user types /exit or Ctrl+C)
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error(chalk_1.default.red('Error starting shell:'), error instanceof Error ? error.message : String(error));
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
// Default to start command
|
|
34
|
+
if (process.argv.length === 2) {
|
|
35
|
+
program.parse(['', '', 'start']);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
program.parse();
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AAEtC,yCAAoC;AACpC,mDAAgD;AAChD,kDAA0B;AAE1B,MAA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AAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LLMService = exports.RafeyShell = void 0;
|
|
4
|
+
var RafeyShell_1 = require("./shell/RafeyShell");
|
|
5
|
+
Object.defineProperty(exports, "RafeyShell", { enumerable: true, get: function () { return RafeyShell_1.RafeyShell; } });
|
|
6
|
+
var LLMService_1 = require("./services/LLMService");
|
|
7
|
+
Object.defineProperty(exports, "LLMService", { enumerable: true, get: function () { return LLMService_1.LLMService; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AACnB,oDAAmD;AAA1C,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../src/prompts/system.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,EAAE,WAIzB,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,MAAM,CAgF1C"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userProfile = void 0;
|
|
4
|
+
exports.buildSystemPrompt = buildSystemPrompt;
|
|
5
|
+
exports.userProfile = {
|
|
6
|
+
name: 'Abdur Rafey Masood',
|
|
7
|
+
profession: 'Founding engineer focused on CLIs and dev tooling',
|
|
8
|
+
interests: ['programming', 'AI', 'technology', 'music', 'books', 'travel', 'self development']
|
|
9
|
+
};
|
|
10
|
+
function buildSystemPrompt() {
|
|
11
|
+
return `You are a virtual copy of Rafey. You know everything about him. You wait for questions from any user and answer from the information you have. If you don't know the answer, you say so. Never say that you are Rafey Shell. When someone asks about Rafey, answer in the third person and say Rafey, never his full name.
|
|
12
|
+
|
|
13
|
+
If the message is a greeting or asks who you are, and you have not already introduced yourself in this conversation, say in your own words that you are a virtual copy of Rafey and that they can ask you anything they would ask him. Say it once. Never paste that same sentence again.
|
|
14
|
+
|
|
15
|
+
If the message is not a question about Rafey, including typos, gibberish, or a random topic, do not introduce yourself again. Say you can't help with that, in fresh wording, and point them back to asking about Rafey. Talk like a person. Never use help-desk lines like "I cannot assist", "please ask a question", or "feel free".
|
|
16
|
+
|
|
17
|
+
USER PROFILE:
|
|
18
|
+
- Name: ${exports.userProfile.name}
|
|
19
|
+
- Profession: ${exports.userProfile.profession}
|
|
20
|
+
- Interests: ${exports.userProfile.interests.join(', ')}
|
|
21
|
+
- Home Country: Pakistan (Islamabad)
|
|
22
|
+
- Current Country: United Kingdom
|
|
23
|
+
- Current City: Harrow, London
|
|
24
|
+
- Website: rafey.ai
|
|
25
|
+
- Current Job: Founding Engineer and Product Lead at Root Bio (VC-backed) since Sep 2025, Stockholm. First engineering hire, building BIO Terminal (BIOT), a CLI for biological discovery. BIOT is used by forward deployed scientists. Stack: Google Cloud, Next.js, Python, Docker, Terraform, and Neo4j.
|
|
26
|
+
|
|
27
|
+
USER BIOGRAPHY:
|
|
28
|
+
Rafey is a software engineer and entrepreneur. He moved to the United Kingdom in 2016 in a persuit of a better life. He received scholarships throughout his education to sustain himself. Rafey lives by four principles: Frugality, Grit, Love and Curiosity. He is a big fan of the book "The Creative Act" by Rick Rubin. In his free time he likes playing the piano and producing music.
|
|
29
|
+
|
|
30
|
+
USER PROFESSIONAL EXPERIENCE:
|
|
31
|
+
- Research Scientist at Guy's and St Thomas' NHS Foundation Trust (July 2018 - October 2018): Worked closely with senior physicians @ Guy's Hospital to develop a web application to detect irregularities in MRI scans. The tool analyzes DICOM (Digital Imaging and Communications in Medicine) files from MRI machines, extracts technical imaging parameters, stores them in a database, and provides visualization tools to identify potentially abnormal parameter values that could indicate equipment issues or scanning problems.
|
|
32
|
+
- Software Engineer at HotelMap (July 2019 - August 2020): Contributed to the backend infrastructure of HotelMap, a hotel discovery and booking platform. He architected and implemented an automated email marketing system that monitors customer engagement, tracks active users throughout their journey, and systematically collects post-stay feedback to enhance the platform's service quality and user experience.
|
|
33
|
+
- Research Scientist at Identity Methods (August 2020 - December 2021): Developed an AI-powered access management system that leverages machine learning to provide intelligent authentication and authorization solutions for enterprise clients. Led the synthetic data generation pipeline to create diverse, representative datasets for model training, ensuring robust performance across various real-world scenarios while maintaining data privacy compliance. Conducted comprehensive model evaluation and benchmarking, experimenting with multiple machine learning architectures including neural networks, ensemble methods, and traditional ML algorithms. Analyzed performance metrics such as accuracy, latency, and scalability to identify the optimal solution that balanced security requirements with user experience.
|
|
34
|
+
- Founding Engineer at Astrobit Technologies Ltd (September 2021 - April 2022): Worked in London on Leaf Line, a ground segment as a service, during the client's early stages. Built a Python library for mission-critical data communication with space assets.
|
|
35
|
+
- Ex-Founder and CTO at Nannie AI (February 2024 - August 2024): Sole engineer and co-founder of a VC-backed pet-care startup in London. Built the initial proof-of-concept platform for 10 to 15 early users. Took the valuation from $0 to $10M in seven months.
|
|
36
|
+
- Founding Engineer and Product Lead at Root Bio (September 2025 - Present): First engineering hire at a VC-backed company in Stockholm, building BIO Terminal (BIOT), a CLI for biological discovery. BIOT is used by forward deployed scientists. The stack is Google Cloud, Next.js, Python, Docker, Terraform, and Neo4j. Set up graph-based RAG so AI agents keep learning. Led the first 4 engineering hires on BIOT.
|
|
37
|
+
|
|
38
|
+
Note: None of the above professional experiences as founder are based on successful exits.
|
|
39
|
+
|
|
40
|
+
EDUCATION:
|
|
41
|
+
- Bachelor of Science in Computer Science from King's College London (September 2016 - September 2019), full scholarship: Built an arrhythmia classifier, a neural network that classified arrhythmia with 93.1% accuracy.
|
|
42
|
+
- Master of Science in Data Science from King's College London (September 2022 - August 2023): Used LLMs to detect fraudulent text messages.
|
|
43
|
+
|
|
44
|
+
USER PERSONAL PROJECTS:
|
|
45
|
+
- Studio X: Founded an independent record label dedicated to discovering and elevating emerging musical talent across London's diverse music scene. Organised a team of 10 music producers and scouted artists to produce and publish their music.
|
|
46
|
+
- Day Off: Building an independent fashion design studio alongside full-time work. Pre-launch, developing the first drop from initial design through to production.
|
|
47
|
+
- Time Complexity article: Authored "Understanding Time Complexity and its Importance in Technology" on Medium, which has had over 40,000 reads.
|
|
48
|
+
|
|
49
|
+
USER PERSONALITY:
|
|
50
|
+
- Ambitious
|
|
51
|
+
- Driven
|
|
52
|
+
- Curious
|
|
53
|
+
- Creative
|
|
54
|
+
- Innovative
|
|
55
|
+
- Passionate
|
|
56
|
+
- Hardworking
|
|
57
|
+
- Persistent
|
|
58
|
+
- Optimistic
|
|
59
|
+
|
|
60
|
+
USER HOBBIES:
|
|
61
|
+
- Reading books
|
|
62
|
+
- Listening to music
|
|
63
|
+
- Producing music
|
|
64
|
+
- Programming
|
|
65
|
+
- Traveling
|
|
66
|
+
- Self development
|
|
67
|
+
- Cooking
|
|
68
|
+
- National-level swimming
|
|
69
|
+
|
|
70
|
+
BEHAVIORAL GUIDELINES:
|
|
71
|
+
- Reference their interests and profession when relevant
|
|
72
|
+
- Be casual and friendly, like talking to a colleague
|
|
73
|
+
- Reference previous conversations when relevant
|
|
74
|
+
- Don't repeat their questions back to them
|
|
75
|
+
- Be direct and get to the point quickly
|
|
76
|
+
|
|
77
|
+
RESPONSE FORMAT:
|
|
78
|
+
- Plain text only. No # headings, no **bold**, no backticks, and no fenced code
|
|
79
|
+
- Two short sentences of plain prose. Then stop.
|
|
80
|
+
- Use a short label line only when the user asked for a list. A label line is a short name, then the fact, with no bullet character.
|
|
81
|
+
- Do not use a bullet list on a greeting or a general question.
|
|
82
|
+
- Make sure to use Rafey and not the full name when responding to user
|
|
83
|
+
- Introduce yourself only once, on the first greeting or when asked who you are. After that, never repeat it.
|
|
84
|
+
- If the message is not about Rafey, say you can't help with that and steer them back to asking about Rafey. Use different wording every time. Talk like a person, not a help desk. Never call yourself Rafey Shell.
|
|
85
|
+
- When asked about Rafey, answer in the third person
|
|
86
|
+
- When asked about Rafey's work at Root Bio, call the product BIO Terminal (BIOT). Do not call it a generic platform.
|
|
87
|
+
- Do not use words like infer, you want to act as if you know everything about Rafey
|
|
88
|
+
|
|
89
|
+
Remember: You're integrated into their terminal workflow, so responses should be optimized for terminal viewing and practical use.`;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../src/prompts/system.ts"],"names":[],"mappings":";;;AAYA,8CAgFC;AAtFY,QAAA,WAAW,GAAgB;IACtC,IAAI,EAAE,oBAAoB;IAC1B,UAAU,EAAE,mDAAmD;IAC/D,SAAS,EAAE,CAAC,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,CAAC;CAC/F,CAAC;AAEF,SAAgB,iBAAiB;IAC/B,OAAO;;;;;;;UAOC,mBAAW,CAAC,IAAI;gBACV,mBAAW,CAAC,UAAU;eACvB,mBAAW,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mIAqEoF,CAAC;AACpI,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UserProfile } from '../prompts/system';
|
|
2
|
+
interface ConversationEntry {
|
|
3
|
+
timestamp: Date;
|
|
4
|
+
query: string;
|
|
5
|
+
response: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class LLMService {
|
|
8
|
+
private apiEndpoint;
|
|
9
|
+
constructor(modelName?: string);
|
|
10
|
+
query(userInput: string, conversationHistory: ConversationEntry[]): Promise<string>;
|
|
11
|
+
private buildContextualPrompt;
|
|
12
|
+
getUserProfile(): UserProfile;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=LLMService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LLMService.d.ts","sourceRoot":"","sources":["../../src/services/LLMService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErF,UAAU,iBAAiB;IACzB,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,WAAW,CAAS;gBAEhB,SAAS,GAAE,MAA2B;IAM5C,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCzF,OAAO,CAAC,qBAAqB;IAwB7B,cAAc,IAAI,WAAW;CAG9B"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LLMService = void 0;
|
|
4
|
+
const system_1 = require("../prompts/system");
|
|
5
|
+
class LLMService {
|
|
6
|
+
constructor(modelName = 'gemini-3.8-flash') {
|
|
7
|
+
// Use environment variable for API endpoint, fallback to production URL
|
|
8
|
+
this.apiEndpoint = process.env.RAFEY_SHELL_API_URL || 'https://rafey-shell.vercel.app/api/chat';
|
|
9
|
+
// Model name can be passed but is handled server-side via environment variable
|
|
10
|
+
}
|
|
11
|
+
async query(userInput, conversationHistory) {
|
|
12
|
+
const systemPrompt = (0, system_1.buildSystemPrompt)();
|
|
13
|
+
const contextualPrompt = this.buildContextualPrompt(userInput, conversationHistory);
|
|
14
|
+
const fullPrompt = `${systemPrompt}\n\n${contextualPrompt}`;
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(this.apiEndpoint, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
prompt: fullPrompt
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
const errorData = await response.json().catch(() => ({}));
|
|
27
|
+
throw new Error(errorData.error || `Server error: ${response.status}`);
|
|
28
|
+
}
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return data.response || 'No response generated.';
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error?.message?.includes('fetch')) {
|
|
34
|
+
throw new Error('Unable to connect to AI service. Please check your internet connection.');
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`API Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
buildContextualPrompt(userInput, history) {
|
|
40
|
+
let prompt = '';
|
|
41
|
+
// Add recent conversation context
|
|
42
|
+
if (history.length > 0) {
|
|
43
|
+
prompt += 'RECENT CONVERSATION CONTEXT:\n';
|
|
44
|
+
const recentHistory = history.slice(-3); // Last 3 exchanges for context
|
|
45
|
+
recentHistory.forEach((entry, index) => {
|
|
46
|
+
prompt += `${index + 1}. User: ${entry.query}\n`;
|
|
47
|
+
prompt += ` Assistant: ${entry.response}\n\n`;
|
|
48
|
+
});
|
|
49
|
+
prompt += '\n';
|
|
50
|
+
}
|
|
51
|
+
// Add current working directory context
|
|
52
|
+
prompt += `CURRENT CONTEXT:
|
|
53
|
+
- Working Directory: ${process.cwd()}
|
|
54
|
+
- Timestamp: ${new Date().toISOString()}
|
|
55
|
+
|
|
56
|
+
USER QUERY: ${userInput}`;
|
|
57
|
+
return prompt;
|
|
58
|
+
}
|
|
59
|
+
getUserProfile() {
|
|
60
|
+
return { ...system_1.userProfile };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.LLMService = LLMService;
|
|
64
|
+
//# sourceMappingURL=LLMService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LLMService.js","sourceRoot":"","sources":["../../src/services/LLMService.ts"],"names":[],"mappings":";;;AAAA,8CAAqF;AAQrF,MAAa,UAAU;IAGrB,YAAY,YAAoB,kBAAkB;QAChD,wEAAwE;QACxE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,yCAAyC,CAAC;QAChG,+EAA+E;IACjF,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,SAAiB,EAAE,mBAAwC;QACrE,MAAM,YAAY,GAAG,IAAA,0BAAiB,GAAE,CAAC;QACzC,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;QACpF,MAAM,UAAU,GAAG,GAAG,YAAY,OAAO,gBAAgB,EAAE,CAAC;QAE5D,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE;gBAC7C,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,MAAM,EAAE,UAAU;iBACnB,CAAC;aACH,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,SAAS,GAAQ,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC/D,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,iBAAiB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;YACzE,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IA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+1,16 @@
|
|
|
1
|
+
export declare class RafeyShell {
|
|
2
|
+
private rl;
|
|
3
|
+
private llmService;
|
|
4
|
+
private conversationHistory;
|
|
5
|
+
private version;
|
|
6
|
+
constructor(model?: string);
|
|
7
|
+
start(): Promise<void>;
|
|
8
|
+
private printBanner;
|
|
9
|
+
private setupEventHandlers;
|
|
10
|
+
private processQuery;
|
|
11
|
+
private typeWriter;
|
|
12
|
+
private handleCommand;
|
|
13
|
+
private showHelp;
|
|
14
|
+
private showHistory;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=RafeyShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RafeyShell.d.ts","sourceRoot":"","sources":["../../src/shell/RafeyShell.ts"],"names":[],"mappings":"AAuEA,qBAAa,UAAU;IACrB,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,mBAAmB,CAA2B;IACtD,OAAO,CAAC,OAAO,CAAiB;gBAEpB,KAAK,GAAE,MAA2B;IAYxC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,kBAAkB;YA6BZ,YAAY;YAyCZ,UAAU;YAYV,aAAa;IA6B3B,OAAO,CAAC,QAAQ;IAiBhB,OAAO,CAAC,WAAW;CAoBpB"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RafeyShell = void 0;
|
|
40
|
+
const fs_1 = require("fs");
|
|
41
|
+
const path_1 = require("path");
|
|
42
|
+
const readline = __importStar(require("readline"));
|
|
43
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
44
|
+
const ora_1 = __importDefault(require("ora"));
|
|
45
|
+
const LLMService_1 = require("../services/LLMService");
|
|
46
|
+
const MUTED = '#8e8e93';
|
|
47
|
+
function muted(text) {
|
|
48
|
+
return chalk_1.default.hex(MUTED)(text);
|
|
49
|
+
}
|
|
50
|
+
function readVersion() {
|
|
51
|
+
try {
|
|
52
|
+
const pkgPath = (0, path_1.join)(__dirname, '..', '..', 'package.json');
|
|
53
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
|
|
54
|
+
return pkg.version ?? '';
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function answerWidth() {
|
|
61
|
+
const columns = process.stdout.columns || 80;
|
|
62
|
+
return Math.max(24, Math.min(68, columns - 2));
|
|
63
|
+
}
|
|
64
|
+
function wrapLine(line, width) {
|
|
65
|
+
const words = line.trim().split(/\s+/).filter(Boolean);
|
|
66
|
+
if (words.length === 0)
|
|
67
|
+
return '';
|
|
68
|
+
const lines = [];
|
|
69
|
+
let current = '';
|
|
70
|
+
for (const word of words) {
|
|
71
|
+
if (!current) {
|
|
72
|
+
current = word;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (current.length + 1 + word.length <= width) {
|
|
76
|
+
current += ` ${word}`;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
lines.push(current);
|
|
80
|
+
current = word;
|
|
81
|
+
}
|
|
82
|
+
if (current)
|
|
83
|
+
lines.push(current);
|
|
84
|
+
return lines.join('\n');
|
|
85
|
+
}
|
|
86
|
+
function wrapText(text, width) {
|
|
87
|
+
return text.split('\n').map((line) => wrapLine(line, width)).join('\n');
|
|
88
|
+
}
|
|
89
|
+
function formatAnswer(text) {
|
|
90
|
+
return wrapText(text.trim(), answerWidth())
|
|
91
|
+
.split('\n')
|
|
92
|
+
.map((line) => (line ? ` ${line}` : ''))
|
|
93
|
+
.join('\n');
|
|
94
|
+
}
|
|
95
|
+
class RafeyShell {
|
|
96
|
+
constructor(model = 'gemini-3.8-flash') {
|
|
97
|
+
this.conversationHistory = [];
|
|
98
|
+
this.version = readVersion();
|
|
99
|
+
this.llmService = new LLMService_1.LLMService(model);
|
|
100
|
+
this.rl = readline.createInterface({
|
|
101
|
+
input: process.stdin,
|
|
102
|
+
output: process.stdout,
|
|
103
|
+
prompt: muted('› '),
|
|
104
|
+
});
|
|
105
|
+
this.setupEventHandlers();
|
|
106
|
+
}
|
|
107
|
+
async start() {
|
|
108
|
+
this.printBanner();
|
|
109
|
+
this.rl.prompt();
|
|
110
|
+
}
|
|
111
|
+
printBanner() {
|
|
112
|
+
const version = this.version ? ` ${muted(this.version)}` : '';
|
|
113
|
+
console.log(`${chalk_1.default.bold('rafey')}${version}`);
|
|
114
|
+
console.log();
|
|
115
|
+
}
|
|
116
|
+
setupEventHandlers() {
|
|
117
|
+
this.rl.on('line', async (input) => {
|
|
118
|
+
const trimmedInput = input.trim();
|
|
119
|
+
if (!trimmedInput) {
|
|
120
|
+
this.rl.prompt();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (trimmedInput.startsWith('/')) {
|
|
124
|
+
await this.handleCommand(trimmedInput);
|
|
125
|
+
this.rl.prompt();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
await this.processQuery(trimmedInput);
|
|
129
|
+
this.rl.prompt();
|
|
130
|
+
});
|
|
131
|
+
this.rl.on('close', () => {
|
|
132
|
+
console.log(muted('\nbye'));
|
|
133
|
+
process.exit(0);
|
|
134
|
+
});
|
|
135
|
+
process.on('SIGINT', () => {
|
|
136
|
+
this.rl.close();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async processQuery(query) {
|
|
140
|
+
const stdin = process.stdin;
|
|
141
|
+
stdin.pause();
|
|
142
|
+
stdin.setRawMode?.(false);
|
|
143
|
+
const spinner = (0, ora_1.default)({
|
|
144
|
+
text: muted('thinking'),
|
|
145
|
+
color: 'gray',
|
|
146
|
+
spinner: 'dots',
|
|
147
|
+
}).start();
|
|
148
|
+
try {
|
|
149
|
+
const response = await this.llmService.query(query, this.conversationHistory);
|
|
150
|
+
spinner.stop();
|
|
151
|
+
console.log();
|
|
152
|
+
await this.typeWriter(formatAnswer(response));
|
|
153
|
+
console.log();
|
|
154
|
+
console.log();
|
|
155
|
+
this.conversationHistory.push({
|
|
156
|
+
timestamp: new Date(),
|
|
157
|
+
query,
|
|
158
|
+
response,
|
|
159
|
+
});
|
|
160
|
+
if (this.conversationHistory.length > 50) {
|
|
161
|
+
this.conversationHistory = this.conversationHistory.slice(-50);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
spinner.stop();
|
|
166
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
167
|
+
console.log();
|
|
168
|
+
console.log(muted(` ${message}`));
|
|
169
|
+
console.log();
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
stdin.read();
|
|
173
|
+
stdin.setRawMode?.(true);
|
|
174
|
+
stdin.resume();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async typeWriter(text, delay = 50) {
|
|
178
|
+
const parts = text.split(/(\s+)/);
|
|
179
|
+
for (const part of parts) {
|
|
180
|
+
if (!part)
|
|
181
|
+
continue;
|
|
182
|
+
process.stdout.write(part);
|
|
183
|
+
if (part.trim().length > 0) {
|
|
184
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async handleCommand(command) {
|
|
189
|
+
const [cmd] = command.slice(1).split(' ');
|
|
190
|
+
switch (cmd.toLowerCase()) {
|
|
191
|
+
case 'help':
|
|
192
|
+
this.showHelp();
|
|
193
|
+
break;
|
|
194
|
+
case 'clear':
|
|
195
|
+
console.clear();
|
|
196
|
+
this.printBanner();
|
|
197
|
+
break;
|
|
198
|
+
case 'history':
|
|
199
|
+
this.showHistory();
|
|
200
|
+
break;
|
|
201
|
+
case 'exit':
|
|
202
|
+
case 'quit':
|
|
203
|
+
this.rl.close();
|
|
204
|
+
break;
|
|
205
|
+
default:
|
|
206
|
+
console.log();
|
|
207
|
+
console.log(muted(` Unknown command: ${cmd}`));
|
|
208
|
+
this.showHelp();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
showHelp() {
|
|
212
|
+
const commands = [
|
|
213
|
+
['/help', 'Show this help message'],
|
|
214
|
+
['/clear', 'Clear the console'],
|
|
215
|
+
['/history', 'Show recent conversation history'],
|
|
216
|
+
['/exit', 'Exit the shell'],
|
|
217
|
+
];
|
|
218
|
+
console.log();
|
|
219
|
+
console.log(muted('commands'));
|
|
220
|
+
console.log();
|
|
221
|
+
for (const [name, description] of commands) {
|
|
222
|
+
console.log(` ${name.padEnd(10)}${muted(description)}`);
|
|
223
|
+
}
|
|
224
|
+
console.log();
|
|
225
|
+
}
|
|
226
|
+
showHistory() {
|
|
227
|
+
console.log();
|
|
228
|
+
console.log(muted('history'));
|
|
229
|
+
console.log();
|
|
230
|
+
if (this.conversationHistory.length === 0) {
|
|
231
|
+
console.log(muted(' No conversation yet.'));
|
|
232
|
+
console.log();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const width = answerWidth();
|
|
236
|
+
this.conversationHistory.slice(-5).forEach((entry, index) => {
|
|
237
|
+
const firstLine = entry.response.trim().split('\n')[0] ?? '';
|
|
238
|
+
const preview = firstLine.length > width ? `${firstLine.slice(0, width - 1)}…` : firstLine;
|
|
239
|
+
console.log(` ${index + 1} ${entry.query}`);
|
|
240
|
+
console.log(muted(` ${preview}`));
|
|
241
|
+
});
|
|
242
|
+
console.log();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
exports.RafeyShell = RafeyShell;
|
|
246
|
+
//# sourceMappingURL=RafeyShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RafeyShell.js","sourceRoot":"","sources":["../../src/shell/RafeyShell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAkC;AAClC,+BAA4B;AAC5B,mDAAqC;AACrC,kDAA0B;AAC1B,8CAAsB;AACtB,uDAAoD;AAEpD,MAAM,KAAK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AAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;QAC5B,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC1D,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7D,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;YAC3F,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,OAAO,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC;CACF;AAjLD,gCAiLC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arafeymasood/rabot",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "An AI-powered shell with personalized LLM assistance",
|
|
5
|
+
"main": "dist/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"rabot": "dist/cli.js",
|
|
8
|
+
"rs": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "ts-node src/cli.ts",
|
|
13
|
+
"start": "node dist/cli.js",
|
|
14
|
+
"prepare": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"cli",
|
|
18
|
+
"ai",
|
|
19
|
+
"shell",
|
|
20
|
+
"llm",
|
|
21
|
+
"assistant"
|
|
22
|
+
],
|
|
23
|
+
"author": "Abdurrafey Masood",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@google/generative-ai": "^0.21.0",
|
|
27
|
+
"chalk": "^4.1.2",
|
|
28
|
+
"commander": "^12.0.0",
|
|
29
|
+
"dotenv": "^16.4.5",
|
|
30
|
+
"ora": "^5.4.1",
|
|
31
|
+
"readline": "^1.3.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.7.4",
|
|
35
|
+
"ts-node": "^10.9.2",
|
|
36
|
+
"typescript": "^5.6.2"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist/**/*",
|
|
43
|
+
"api/**/*",
|
|
44
|
+
"vercel.json",
|
|
45
|
+
"README.md",
|
|
46
|
+
"package.json"
|
|
47
|
+
],
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/abdurmasood/rabot.git"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"registry": "https://registry.npmjs.org"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/abdurmasood/rabot/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/abdurmasood/rabot#readme"
|
|
60
|
+
}
|