@ihsandeen/aya 1.0.0
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/CONTRIBUTING.md +39 -0
- package/LICENSE +21 -0
- package/README.md +141 -0
- package/dist/commands/adab.js +28 -0
- package/dist/commands/adhan.js +58 -0
- package/dist/commands/anatomy.js +29 -0
- package/dist/commands/blame.js +29 -0
- package/dist/commands/commit.js +44 -0
- package/dist/commands/diff.js +54 -0
- package/dist/commands/dua.js +34 -0
- package/dist/commands/fast.js +36 -0
- package/dist/commands/friday.js +21 -0
- package/dist/commands/hero.js +69 -0
- package/dist/commands/hijri.js +42 -0
- package/dist/commands/history.js +98 -0
- package/dist/commands/init.js +54 -0
- package/dist/commands/invest.js +26 -0
- package/dist/commands/journal.js +84 -0
- package/dist/commands/journey.js +24 -0
- package/dist/commands/lens.js +58 -0
- package/dist/commands/memorize.js +117 -0
- package/dist/commands/mirror.js +47 -0
- package/dist/commands/names.js +48 -0
- package/dist/commands/nature.js +28 -0
- package/dist/commands/nazm.js +100 -0
- package/dist/commands/parable.js +332 -0
- package/dist/commands/prayers.js +63 -0
- package/dist/commands/pull.js +28 -0
- package/dist/commands/push.js +156 -0
- package/dist/commands/qibla.js +118 -0
- package/dist/commands/repo.js +34 -0
- package/dist/commands/sabr.js +32 -0
- package/dist/commands/scene.js +54 -0
- package/dist/commands/seek.js +28 -0
- package/dist/commands/shukr.js +22 -0
- package/dist/commands/sleep.js +26 -0
- package/dist/commands/sound.js +35 -0
- package/dist/commands/status.js +109 -0
- package/dist/commands/sunnah.js +24 -0
- package/dist/commands/tafsir.js +89 -0
- package/dist/commands/tasbih.js +50 -0
- package/dist/commands/wudu.js +22 -0
- package/dist/commands/zakat.js +72 -0
- package/dist/data/commands-db.js +365 -0
- package/dist/data/events.js +105 -0
- package/dist/data/gems.js +160 -0
- package/dist/data/nak.js +616 -0
- package/dist/data/tafsir.js +157 -0
- package/dist/data/vocab.js +105 -0
- package/dist/index.js +86 -0
- package/dist/server.js +140 -0
- package/dist/utils/config.js +38 -0
- package/dist/utils/logger.js +104 -0
- package/dist/utils/printer.js +36 -0
- package/docs/index.html +1048 -0
- package/docs/repo.html +952 -0
- package/package.json +55 -0
- package/public/hero.html +285 -0
- package/public/index.html +1039 -0
- package/public/repo.html +904 -0
- package/src/commands/adab.ts +24 -0
- package/src/commands/adhan.ts +55 -0
- package/src/commands/anatomy.ts +25 -0
- package/src/commands/blame.ts +31 -0
- package/src/commands/commit.ts +42 -0
- package/src/commands/diff.ts +56 -0
- package/src/commands/dua.ts +34 -0
- package/src/commands/fast.ts +35 -0
- package/src/commands/friday.ts +17 -0
- package/src/commands/hero.ts +73 -0
- package/src/commands/hijri.ts +43 -0
- package/src/commands/history.ts +103 -0
- package/src/commands/init.ts +53 -0
- package/src/commands/invest.ts +22 -0
- package/src/commands/journal.ts +97 -0
- package/src/commands/journey.ts +20 -0
- package/src/commands/lens.ts +58 -0
- package/src/commands/memorize.ts +131 -0
- package/src/commands/mirror.ts +48 -0
- package/src/commands/names.ts +46 -0
- package/src/commands/nature.ts +24 -0
- package/src/commands/nazm.ts +102 -0
- package/src/commands/parable.ts +360 -0
- package/src/commands/prayers.ts +65 -0
- package/src/commands/pull.ts +28 -0
- package/src/commands/push.ts +171 -0
- package/src/commands/qibla.ts +127 -0
- package/src/commands/repo.ts +34 -0
- package/src/commands/sabr.ts +28 -0
- package/src/commands/scene.ts +56 -0
- package/src/commands/seek.ts +24 -0
- package/src/commands/shukr.ts +19 -0
- package/src/commands/sleep.ts +23 -0
- package/src/commands/sound.ts +34 -0
- package/src/commands/status.ts +132 -0
- package/src/commands/sunnah.ts +21 -0
- package/src/commands/tafsir.ts +86 -0
- package/src/commands/tasbih.ts +49 -0
- package/src/commands/wudu.ts +19 -0
- package/src/commands/zakat.ts +73 -0
- package/src/data/commands-db.ts +372 -0
- package/src/data/events.ts +113 -0
- package/src/data/gems.ts +163 -0
- package/src/data/nak.ts +805 -0
- package/src/data/tafsir.ts +165 -0
- package/src/data/vocab.ts +114 -0
- package/src/index.ts +94 -0
- package/src/server.ts +128 -0
- package/src/utils/config.ts +44 -0
- package/src/utils/logger.ts +122 -0
- package/src/utils/printer.ts +38 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import { printCommandHeader } from '../utils/printer';
|
|
5
|
+
|
|
6
|
+
interface Parable {
|
|
7
|
+
name: string;
|
|
8
|
+
surah: string;
|
|
9
|
+
ayah: string;
|
|
10
|
+
title: string;
|
|
11
|
+
animate: () => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const sleep = (ms: number) => new Promise(r => setTimeout(r, ms));
|
|
15
|
+
|
|
16
|
+
const spiderParable: Parable = {
|
|
17
|
+
name: 'spider',
|
|
18
|
+
surah: 'Al-Ankabut',
|
|
19
|
+
ayah: '29:41',
|
|
20
|
+
title: 'The House of the Spider',
|
|
21
|
+
animate: async () => {
|
|
22
|
+
console.clear();
|
|
23
|
+
const frames = [
|
|
24
|
+
`
|
|
25
|
+
/ \\
|
|
26
|
+
/ \\
|
|
27
|
+
/ \\
|
|
28
|
+
/_______\\
|
|
29
|
+
| |
|
|
30
|
+
| |
|
|
31
|
+
`,
|
|
32
|
+
`
|
|
33
|
+
/ \\
|
|
34
|
+
/ \\
|
|
35
|
+
/ š·ļø \\
|
|
36
|
+
/_______\\
|
|
37
|
+
| |
|
|
38
|
+
| |
|
|
39
|
+
`,
|
|
40
|
+
`
|
|
41
|
+
/ \\
|
|
42
|
+
/ šŖ° \\
|
|
43
|
+
/ š·ļø \\
|
|
44
|
+
/_______\\
|
|
45
|
+
| |
|
|
46
|
+
| |
|
|
47
|
+
`
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
// Build the web
|
|
51
|
+
for (const frame of frames) {
|
|
52
|
+
console.clear();
|
|
53
|
+
console.log(chalk.gray(frame));
|
|
54
|
+
await sleep(800);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
await sleep(500);
|
|
58
|
+
console.log(chalk.white.italic('\n"The example of those who take allies other than Allah..."'));
|
|
59
|
+
await sleep(2500);
|
|
60
|
+
console.log(chalk.white.italic('"...is that of the spider who builds a house."'));
|
|
61
|
+
await sleep(2500);
|
|
62
|
+
|
|
63
|
+
// Crumble animation
|
|
64
|
+
const crumblingFrames = [
|
|
65
|
+
`
|
|
66
|
+
/ \\
|
|
67
|
+
/ šŖ° \\
|
|
68
|
+
/ š·ļø \\
|
|
69
|
+
/_______\\
|
|
70
|
+
| |
|
|
71
|
+
| |
|
|
72
|
+
`,
|
|
73
|
+
`
|
|
74
|
+
/ \\
|
|
75
|
+
/ \\
|
|
76
|
+
/ š·ļø \\
|
|
77
|
+
/ \\
|
|
78
|
+
| |
|
|
79
|
+
| |
|
|
80
|
+
`,
|
|
81
|
+
`
|
|
82
|
+
/
|
|
83
|
+
/
|
|
84
|
+
š·ļø
|
|
85
|
+
/
|
|
86
|
+
|
|
|
87
|
+
|
|
|
88
|
+
`,
|
|
89
|
+
`
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
š·ļø
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
`,
|
|
97
|
+
`
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
`
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
for (const frame of crumblingFrames) {
|
|
108
|
+
console.clear();
|
|
109
|
+
console.log(chalk.gray(frame));
|
|
110
|
+
await sleep(400); // Slower crumble to be visible
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
console.clear();
|
|
114
|
+
console.log(chalk.red.bold('\nThe web is gone.'));
|
|
115
|
+
await sleep(1000);
|
|
116
|
+
console.log(chalk.white.bold('\n"And indeed, the weakest of houses is the house of the spider." (29:41)'));
|
|
117
|
+
console.log(chalk.gray('\nLesson: Reliance on anything other than Allah is like leaning on a spider web.'));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const rainParable: Parable = {
|
|
122
|
+
name: 'rain',
|
|
123
|
+
surah: 'Al-Baqarah',
|
|
124
|
+
ayah: '2:265',
|
|
125
|
+
title: 'The Heavy Rain',
|
|
126
|
+
animate: async () => {
|
|
127
|
+
console.clear();
|
|
128
|
+
const clouds = `
|
|
129
|
+
āļø āļø āļø
|
|
130
|
+
`;
|
|
131
|
+
console.log(clouds);
|
|
132
|
+
await sleep(1000);
|
|
133
|
+
|
|
134
|
+
const rainFrames = [
|
|
135
|
+
`
|
|
136
|
+
āļø āļø āļø
|
|
137
|
+
š§ š§ š§
|
|
138
|
+
`,
|
|
139
|
+
`
|
|
140
|
+
āļø āļø āļø
|
|
141
|
+
|
|
142
|
+
š§ š§ š§
|
|
143
|
+
`,
|
|
144
|
+
`
|
|
145
|
+
āļø āļø āļø
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
š§ š§ š§
|
|
149
|
+
`,
|
|
150
|
+
`
|
|
151
|
+
āļø āļø āļø
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
š± š± š±
|
|
155
|
+
========
|
|
156
|
+
`
|
|
157
|
+
];
|
|
158
|
+
|
|
159
|
+
for (let i = 0; i < 4; i++) { // Loop rain a few times
|
|
160
|
+
for (const frame of rainFrames.slice(0, 3)) {
|
|
161
|
+
console.clear();
|
|
162
|
+
console.log(chalk.blue(frame));
|
|
163
|
+
await sleep(200);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Final growth
|
|
168
|
+
console.clear();
|
|
169
|
+
console.log(chalk.green(rainFrames[3]));
|
|
170
|
+
|
|
171
|
+
await sleep(1000);
|
|
172
|
+
console.log(chalk.green.bold('\nLife springs forth.'));
|
|
173
|
+
console.log(chalk.white.italic('\n"And Allah sees what you do. Sincerity makes even small deeds grow like a garden after rain."'));
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const lightParable: Parable = {
|
|
178
|
+
name: 'light',
|
|
179
|
+
surah: 'An-Nur',
|
|
180
|
+
ayah: '24:35',
|
|
181
|
+
title: 'Light upon Light',
|
|
182
|
+
animate: async () => {
|
|
183
|
+
const lampFrames = [
|
|
184
|
+
`
|
|
185
|
+
āØ
|
|
186
|
+
šÆļø
|
|
187
|
+
š”
|
|
188
|
+
š
|
|
189
|
+
`,
|
|
190
|
+
`
|
|
191
|
+
āØ
|
|
192
|
+
šÆļø
|
|
193
|
+
š”
|
|
194
|
+
š
|
|
195
|
+
`,
|
|
196
|
+
`
|
|
197
|
+
āØ
|
|
198
|
+
šÆļø
|
|
199
|
+
š”
|
|
200
|
+
š
|
|
201
|
+
`,
|
|
202
|
+
`
|
|
203
|
+
āØ
|
|
204
|
+
šÆļø
|
|
205
|
+
š”
|
|
206
|
+
š
|
|
207
|
+
`
|
|
208
|
+
];
|
|
209
|
+
|
|
210
|
+
console.log(chalk.white.italic('\n"Allah is the Light of the heavens and the earth."'));
|
|
211
|
+
await sleep(1500);
|
|
212
|
+
|
|
213
|
+
for (let i = 0; i < 10; i++) {
|
|
214
|
+
console.clear();
|
|
215
|
+
const frame = lampFrames[i % lampFrames.length];
|
|
216
|
+
// Randomly colorize for flickering effect
|
|
217
|
+
const color = Math.random() > 0.5 ? chalk.yellow : chalk.yellowBright;
|
|
218
|
+
console.log(color.bold(frame));
|
|
219
|
+
await sleep(200);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
console.log(chalk.white.italic('\n"Light upon light. Allah guides to His light whom He wills."'));
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const ropeParable: Parable = {
|
|
227
|
+
name: 'rope',
|
|
228
|
+
surah: 'Ali \'Imran',
|
|
229
|
+
ayah: '3:103',
|
|
230
|
+
title: 'The Rope of Allah',
|
|
231
|
+
animate: async () => {
|
|
232
|
+
console.clear();
|
|
233
|
+
const frames = [
|
|
234
|
+
`
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
( ALL )
|
|
240
|
+
\\_______/
|
|
241
|
+
`,
|
|
242
|
+
`
|
|
243
|
+
|
|
|
244
|
+
|
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
( ALL )
|
|
248
|
+
\\_______/
|
|
249
|
+
`,
|
|
250
|
+
`
|
|
251
|
+
|
|
|
252
|
+
|
|
|
253
|
+
|
|
|
254
|
+
|
|
|
255
|
+
( ALL )
|
|
256
|
+
\\_______/
|
|
257
|
+
`,
|
|
258
|
+
`
|
|
259
|
+
|
|
|
260
|
+
|
|
|
261
|
+
/|\\
|
|
262
|
+
/ | \\
|
|
263
|
+
/ | \\
|
|
264
|
+
( š¤ ALL š¤ )
|
|
265
|
+
\\_______/
|
|
266
|
+
`
|
|
267
|
+
];
|
|
268
|
+
|
|
269
|
+
for (const frame of frames) {
|
|
270
|
+
console.clear();
|
|
271
|
+
console.log(chalk.blue(frame));
|
|
272
|
+
await sleep(800);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
await sleep(500);
|
|
276
|
+
console.log(chalk.yellow('\nImagine if everyone let go... š'));
|
|
277
|
+
await sleep(2000);
|
|
278
|
+
console.log(chalk.green('\nBut if we hold tight... š¤'));
|
|
279
|
+
await sleep(1000);
|
|
280
|
+
|
|
281
|
+
console.log(chalk.white.italic('\n"And hold firmly to the rope of Allah all together and do not become divided." (3:103)'));
|
|
282
|
+
console.log(chalk.gray('\nTadabbur: The "Rope" is the Quran/Covenant. Holding it *together* is our only safety from the pit of fire.'));
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const treeParable: Parable = {
|
|
287
|
+
name: 'tree',
|
|
288
|
+
surah: 'Ibrahim',
|
|
289
|
+
ayah: '14:24',
|
|
290
|
+
title: 'The Good Tree',
|
|
291
|
+
animate: async () => {
|
|
292
|
+
const frames = [
|
|
293
|
+
`
|
|
294
|
+
. (seed)
|
|
295
|
+
`,
|
|
296
|
+
`
|
|
297
|
+
š±
|
|
298
|
+
`,
|
|
299
|
+
`
|
|
300
|
+
šæ
|
|
301
|
+
|
|
|
302
|
+
`,
|
|
303
|
+
`
|
|
304
|
+
š³
|
|
305
|
+
|
|
|
306
|
+
|
|
|
307
|
+
`,
|
|
308
|
+
`
|
|
309
|
+
š³š³
|
|
310
|
+
||
|
|
311
|
+
||
|
|
312
|
+
root
|
|
313
|
+
`
|
|
314
|
+
];
|
|
315
|
+
|
|
316
|
+
for (const frame of frames) {
|
|
317
|
+
console.clear();
|
|
318
|
+
console.log(chalk.green(frame));
|
|
319
|
+
await sleep(800);
|
|
320
|
+
}
|
|
321
|
+
console.log(chalk.white.italic('\n"A good word is like a good tree, its root is firm and its branches are in the sky."'));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
const parables: Parable[] = [spiderParable, rainParable, lightParable, ropeParable, treeParable];
|
|
327
|
+
|
|
328
|
+
export const parableCommand = new Command('parable')
|
|
329
|
+
.description('Visual Quranic Metaphors (Animated)')
|
|
330
|
+
.argument('[name]', 'Name of the parable (e.g., spider, rain, light)')
|
|
331
|
+
.action(async (name) => {
|
|
332
|
+
printCommandHeader('parable');
|
|
333
|
+
let selectedParable;
|
|
334
|
+
|
|
335
|
+
if (name) {
|
|
336
|
+
selectedParable = parables.find(p => p.name.toLowerCase() === name.toLowerCase());
|
|
337
|
+
if (!selectedParable) {
|
|
338
|
+
console.log(chalk.red('Parable not found.'));
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
const answers = await inquirer.prompt([
|
|
343
|
+
{
|
|
344
|
+
type: 'list',
|
|
345
|
+
name: 'parable',
|
|
346
|
+
message: 'Choose a parable to visualize:',
|
|
347
|
+
choices: parables.map(p => p.name)
|
|
348
|
+
}
|
|
349
|
+
]);
|
|
350
|
+
selectedParable = parables.find(p => p.name === answers.parable);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (selectedParable) {
|
|
354
|
+
console.clear();
|
|
355
|
+
console.log(chalk.green.bold(`\n${selectedParable.title}`));
|
|
356
|
+
console.log(chalk.gray(`Surah ${selectedParable.surah} (${selectedParable.ayah})`));
|
|
357
|
+
await sleep(1500);
|
|
358
|
+
await selectedParable.animate();
|
|
359
|
+
}
|
|
360
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import axios from 'axios';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
import { getConfig, setConfig } from '../utils/config';
|
|
7
|
+
import { printCommandHeader } from '../utils/printer';
|
|
8
|
+
|
|
9
|
+
export const prayersCommand = new Command('prayers')
|
|
10
|
+
.description('Show Prayer Times')
|
|
11
|
+
.option('-c, --config', 'Configure location')
|
|
12
|
+
.action(async (options) => {
|
|
13
|
+
printCommandHeader('prayers');
|
|
14
|
+
let config = getConfig();
|
|
15
|
+
|
|
16
|
+
if (options.config || !config.location?.city || !config.location?.country) {
|
|
17
|
+
const answers = await inquirer.prompt([
|
|
18
|
+
{ type: 'input', name: 'city', message: 'Enter your city:', default: config.location?.city },
|
|
19
|
+
{ type: 'input', name: 'country', message: 'Enter your country:', default: config.location?.country }
|
|
20
|
+
]);
|
|
21
|
+
config.location = { city: answers.city, country: answers.country };
|
|
22
|
+
setConfig(config);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { city, country } = config.location;
|
|
26
|
+
const spinner = ora(`Fetching prayer times for ${city}, ${country}...`).start();
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
const response = await axios.get('http://api.aladhan.com/v1/timingsByCity', {
|
|
30
|
+
params: {
|
|
31
|
+
city,
|
|
32
|
+
country,
|
|
33
|
+
method: 2 // ISNA (can be configurable later)
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
spinner.stop();
|
|
38
|
+
const timings = response.data.data.timings;
|
|
39
|
+
const date = response.data.data.date.readable;
|
|
40
|
+
const hijri = response.data.data.date.hijri;
|
|
41
|
+
|
|
42
|
+
console.clear();
|
|
43
|
+
console.log(chalk.green.bold(`\n Prayer Times for ${city}, ${country}`));
|
|
44
|
+
console.log(chalk.gray(` ${date} | ${hijri.day} ${hijri.month.en} ${hijri.year}`));
|
|
45
|
+
console.log(chalk.gray('----------------------------------------'));
|
|
46
|
+
|
|
47
|
+
const prayers = [
|
|
48
|
+
{ name: 'Fajr', time: timings.Fajr, icon: '[FAJR]' },
|
|
49
|
+
{ name: 'Sunrise', time: timings.Sunrise, icon: '[SHRQ]' },
|
|
50
|
+
{ name: 'Dhuhr', time: timings.Dhuhr, icon: '[DHUR]' },
|
|
51
|
+
{ name: 'Asr', time: timings.Asr, icon: '[ASR ]' },
|
|
52
|
+
{ name: 'Maghrib', time: timings.Maghrib, icon: '[MAGH]' },
|
|
53
|
+
{ name: 'Isha', time: timings.Isha, icon: '[ISHA]' }
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
prayers.forEach(p => {
|
|
57
|
+
console.log(`${p.icon} ${chalk.bold(p.name.padEnd(10))} ${chalk.cyan(p.time)}`);
|
|
58
|
+
});
|
|
59
|
+
console.log('');
|
|
60
|
+
|
|
61
|
+
} catch (error) {
|
|
62
|
+
spinner.fail('Failed to fetch prayer times.');
|
|
63
|
+
console.error(chalk.red('Please check your internet connection or location settings.'));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { gems } from '../data/gems';
|
|
5
|
+
import { printCommandHeader } from '../utils/printer';
|
|
6
|
+
|
|
7
|
+
export const pullCommand = new Command('pull')
|
|
8
|
+
.description('Pull a random ayah or hadith for reflection')
|
|
9
|
+
.action(async () => {
|
|
10
|
+
printCommandHeader('pull');
|
|
11
|
+
const spinner = ora('Fetching divine wisdom...').start();
|
|
12
|
+
|
|
13
|
+
// Simulate a small delay for effect
|
|
14
|
+
await new Promise(resolve => setTimeout(resolve, 800));
|
|
15
|
+
|
|
16
|
+
const randomGem = gems[Math.floor(Math.random() * gems.length)];
|
|
17
|
+
|
|
18
|
+
spinner.succeed(chalk.green('Reflection loaded.'));
|
|
19
|
+
console.log('');
|
|
20
|
+
|
|
21
|
+
console.log(chalk.yellow.bold(`"${randomGem.text}"`));
|
|
22
|
+
console.log(chalk.gray(`ā ${randomGem.source}`));
|
|
23
|
+
console.log('');
|
|
24
|
+
|
|
25
|
+
console.log(chalk.blue.bold('Language Gem:'));
|
|
26
|
+
console.log(chalk.white(randomGem.reflection));
|
|
27
|
+
console.log('');
|
|
28
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import fs from 'fs';
|
|
5
|
+
import path from 'path';
|
|
6
|
+
import { printCommandHeader } from '../utils/printer';
|
|
7
|
+
import boxen from 'boxen';
|
|
8
|
+
|
|
9
|
+
// Store Duas in the local project scope (like Pull Requests)
|
|
10
|
+
const DUA_FILE = path.join(process.cwd(), '.aya', 'duas.json');
|
|
11
|
+
|
|
12
|
+
export const pushCommand = new Command('push')
|
|
13
|
+
.description('Push goodness to the world (Sadaqah/Du\'a) or your Dua Jar')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
printCommandHeader('push');
|
|
16
|
+
|
|
17
|
+
const choices = [
|
|
18
|
+
{ name: 'š Push to Origin Jannah (Daily Sadaqah/Deed)', value: 'sadaqah' },
|
|
19
|
+
{ name: 'šŗ Push to Dua Jar (My Personal PRs)', value: 'dua' }
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const { mode } = await inquirer.prompt([
|
|
23
|
+
{
|
|
24
|
+
type: 'list',
|
|
25
|
+
name: 'mode',
|
|
26
|
+
message: 'Select your push target:',
|
|
27
|
+
choices
|
|
28
|
+
}
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
if (mode === 'sadaqah') {
|
|
32
|
+
showDailyDeed();
|
|
33
|
+
} else {
|
|
34
|
+
await handleDuaJar();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function showDailyDeed() {
|
|
39
|
+
console.log(chalk.green.bold('\nš Pushing to origin jannah...'));
|
|
40
|
+
|
|
41
|
+
const actions = [
|
|
42
|
+
{
|
|
43
|
+
text: "Make du'a for the oppressed around the world.",
|
|
44
|
+
link: "Prophet (saw) said: 'The du'a of a Muslim for his brother in his absence is readily accepted.'"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
text: "Donate to a verified charity today.",
|
|
48
|
+
link: "LaunchGood.com / IslamicRelief.com"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
text: "Call your parents.",
|
|
52
|
+
link: "Paradise lies at the feet of your mother."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
text: "Remove something harmful from the path.",
|
|
56
|
+
link: "It is a branch of faith."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
text: "Smile at your brother/sister.",
|
|
60
|
+
link: "It is a charity."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
text: "Feed a stray cat or bird.",
|
|
64
|
+
link: "There is reward in serving every living liver."
|
|
65
|
+
}
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
const randomAction = actions[Math.floor(Math.random() * actions.length)];
|
|
69
|
+
|
|
70
|
+
console.log(
|
|
71
|
+
boxen(
|
|
72
|
+
chalk.white(`Action item: ${chalk.bold(randomAction.text)}`) + '\n' +
|
|
73
|
+
chalk.gray(randomAction.link),
|
|
74
|
+
{
|
|
75
|
+
padding: 1,
|
|
76
|
+
margin: 1,
|
|
77
|
+
borderStyle: 'round',
|
|
78
|
+
borderColor: 'yellow',
|
|
79
|
+
title: 'Daily Sadaqah Commit',
|
|
80
|
+
titleAlignment: 'center'
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
console.log(chalk.yellow('Your code is temporary. Your impact is eternal.'));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function handleDuaJar() {
|
|
89
|
+
const { action } = await inquirer.prompt([
|
|
90
|
+
{
|
|
91
|
+
type: 'list',
|
|
92
|
+
name: 'action',
|
|
93
|
+
message: 'Dua Jar Options:',
|
|
94
|
+
choices: [
|
|
95
|
+
{ name: 'š Add a new Dua (Open PR)', value: 'add' },
|
|
96
|
+
{ name: '𤲠Pull a random Dua (Review)', value: 'pull' },
|
|
97
|
+
{ name: 'š List all Duas (Log)', value: 'list' }
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
const duas = loadDuas();
|
|
103
|
+
|
|
104
|
+
if (action === 'add') {
|
|
105
|
+
const { duaText } = await inquirer.prompt([
|
|
106
|
+
{
|
|
107
|
+
type: 'input',
|
|
108
|
+
name: 'duaText',
|
|
109
|
+
message: 'Write your dua here:'
|
|
110
|
+
}
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
if (duaText.trim()) {
|
|
114
|
+
duas.push({
|
|
115
|
+
text: duaText,
|
|
116
|
+
date: new Date().toISOString()
|
|
117
|
+
});
|
|
118
|
+
saveDuas(duas);
|
|
119
|
+
console.log(chalk.green('\nā
Dua pushed to the jar. May Allah accept it.'));
|
|
120
|
+
}
|
|
121
|
+
} else if (action === 'pull') {
|
|
122
|
+
if (duas.length === 0) {
|
|
123
|
+
console.log(chalk.yellow('\nYour Dua Jar is empty. Add some duas first!'));
|
|
124
|
+
} else {
|
|
125
|
+
const randomDua = duas[Math.floor(Math.random() * duas.length)];
|
|
126
|
+
|
|
127
|
+
console.log(
|
|
128
|
+
boxen(
|
|
129
|
+
chalk.white.bold(`"${randomDua.text}"`) + '\n\n' +
|
|
130
|
+
chalk.gray(`(Added on ${new Date(randomDua.date).toLocaleDateString()})`),
|
|
131
|
+
{
|
|
132
|
+
padding: 1,
|
|
133
|
+
margin: 1,
|
|
134
|
+
borderStyle: 'double',
|
|
135
|
+
borderColor: 'cyan',
|
|
136
|
+
title: '⨠A Dua from your Jar',
|
|
137
|
+
titleAlignment: 'center'
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
} else if (action === 'list') {
|
|
143
|
+
if (duas.length === 0) {
|
|
144
|
+
console.log(chalk.yellow('\nYour Dua Jar is empty.'));
|
|
145
|
+
} else {
|
|
146
|
+
console.log(chalk.cyan('\nš Your Saved Duas:'));
|
|
147
|
+
duas.forEach((d, i) => {
|
|
148
|
+
console.log(chalk.white(`${i + 1}. ${d.text}`));
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function loadDuas(): { text: string; date: string }[] {
|
|
155
|
+
if (fs.existsSync(DUA_FILE)) {
|
|
156
|
+
try {
|
|
157
|
+
return JSON.parse(fs.readFileSync(DUA_FILE, 'utf-8'));
|
|
158
|
+
} catch (e) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function saveDuas(duas: { text: string; date: string }[]) {
|
|
166
|
+
const dir = path.dirname(DUA_FILE);
|
|
167
|
+
if (!fs.existsSync(dir)) {
|
|
168
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
169
|
+
}
|
|
170
|
+
fs.writeFileSync(DUA_FILE, JSON.stringify(duas, null, 2));
|
|
171
|
+
}
|