@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,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.nazmCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const nak_1 = require("../data/nak");
|
|
10
|
+
const printer_1 = require("../utils/printer");
|
|
11
|
+
exports.nazmCommand = new commander_1.Command('nazm')
|
|
12
|
+
.description('The Symmetry Visualizer (Ring Structure)')
|
|
13
|
+
.argument('[surah]', 'The Surah to visualize (e.g. fatiha)')
|
|
14
|
+
.action((surah) => {
|
|
15
|
+
(0, printer_1.printCommandHeader)('nazm');
|
|
16
|
+
const data = nak_1.nazmData.find(d => d.surah.toLowerCase().includes(surah?.toLowerCase() || 'fatiha'));
|
|
17
|
+
if (!data) {
|
|
18
|
+
console.log(chalk_1.default.red('Symmetry structure not found for that Surah.'));
|
|
19
|
+
console.log(chalk_1.default.gray('Currently available: Al-Fatiha'));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
console.clear();
|
|
23
|
+
console.log(chalk_1.default.green.bold(`\n Aya Nazm: ${data.surah}`));
|
|
24
|
+
console.log(chalk_1.default.gray(data.description));
|
|
25
|
+
console.log(chalk_1.default.gray('----------------------------------------\n'));
|
|
26
|
+
const lines = data.ayahs;
|
|
27
|
+
const connections = data.connections;
|
|
28
|
+
const center = data.center;
|
|
29
|
+
// 1. Sort connections by size (distance) -> smallest first (innermost)
|
|
30
|
+
const sortedConns = [...connections].sort((a, b) => {
|
|
31
|
+
const distA = Math.abs(a[1] - a[0]);
|
|
32
|
+
const distB = Math.abs(b[1] - b[0]);
|
|
33
|
+
return distA - distB;
|
|
34
|
+
});
|
|
35
|
+
const maxLineLen = 50; // Truncate text for display
|
|
36
|
+
const padding = 2;
|
|
37
|
+
lines.forEach((line, index) => {
|
|
38
|
+
const ayahNum = index + 1;
|
|
39
|
+
// Prepare text part
|
|
40
|
+
let textPart = `${ayahNum}. ${line}`;
|
|
41
|
+
if (textPart.length > maxLineLen) {
|
|
42
|
+
textPart = textPart.substring(0, maxLineLen - 3) + '...';
|
|
43
|
+
}
|
|
44
|
+
textPart = textPart.padEnd(maxLineLen + padding);
|
|
45
|
+
// Prepare tracks
|
|
46
|
+
const tracks = [];
|
|
47
|
+
let activeConnIdx = -1;
|
|
48
|
+
for (let i = 0; i < sortedConns.length; i++) {
|
|
49
|
+
const [start, end] = sortedConns[i];
|
|
50
|
+
const min = Math.min(start, end);
|
|
51
|
+
const max = Math.max(start, end);
|
|
52
|
+
if (ayahNum === min) {
|
|
53
|
+
tracks[i] = 'ā';
|
|
54
|
+
activeConnIdx = i;
|
|
55
|
+
}
|
|
56
|
+
else if (ayahNum === max) {
|
|
57
|
+
tracks[i] = 'ā';
|
|
58
|
+
activeConnIdx = i;
|
|
59
|
+
}
|
|
60
|
+
else if (ayahNum > min && ayahNum < max) {
|
|
61
|
+
tracks[i] = 'ā';
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
tracks[i] = ' ';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Build the visual string
|
|
68
|
+
let visual = '';
|
|
69
|
+
for (let i = 0; i < sortedConns.length; i++) {
|
|
70
|
+
const char = tracks[i];
|
|
71
|
+
const isTarget = i === activeConnIdx;
|
|
72
|
+
const isInner = i < activeConnIdx;
|
|
73
|
+
// If this track is the target (start/end), we connect to it
|
|
74
|
+
if (isTarget) {
|
|
75
|
+
visual += chalk_1.default.cyan('āā' + char);
|
|
76
|
+
}
|
|
77
|
+
// If this track is inner to the target, we draw a line through it
|
|
78
|
+
else if (isInner && activeConnIdx !== -1) {
|
|
79
|
+
// Verify we are not overwriting a vertical line (should not happen in proper nesting)
|
|
80
|
+
if (char === 'ā')
|
|
81
|
+
visual += chalk_1.default.cyan('āāā'); // Crossing?
|
|
82
|
+
else
|
|
83
|
+
visual += chalk_1.default.cyan('āāā');
|
|
84
|
+
}
|
|
85
|
+
// If this track is outer or unrelated
|
|
86
|
+
else {
|
|
87
|
+
if (char === 'ā')
|
|
88
|
+
visual += chalk_1.default.cyan(' ā');
|
|
89
|
+
else
|
|
90
|
+
visual += ' ';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Add center marker if applicable
|
|
94
|
+
if (center && ayahNum === center) {
|
|
95
|
+
visual += chalk_1.default.yellow(' << The Heart');
|
|
96
|
+
}
|
|
97
|
+
console.log(textPart + visual);
|
|
98
|
+
});
|
|
99
|
+
console.log('');
|
|
100
|
+
});
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parableCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const printer_1 = require("../utils/printer");
|
|
11
|
+
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
|
|
12
|
+
const spiderParable = {
|
|
13
|
+
name: 'spider',
|
|
14
|
+
surah: 'Al-Ankabut',
|
|
15
|
+
ayah: '29:41',
|
|
16
|
+
title: 'The House of the Spider',
|
|
17
|
+
animate: async () => {
|
|
18
|
+
console.clear();
|
|
19
|
+
const frames = [
|
|
20
|
+
`
|
|
21
|
+
/ \\
|
|
22
|
+
/ \\
|
|
23
|
+
/ \\
|
|
24
|
+
/_______\\
|
|
25
|
+
| |
|
|
26
|
+
| |
|
|
27
|
+
`,
|
|
28
|
+
`
|
|
29
|
+
/ \\
|
|
30
|
+
/ \\
|
|
31
|
+
/ š·ļø \\
|
|
32
|
+
/_______\\
|
|
33
|
+
| |
|
|
34
|
+
| |
|
|
35
|
+
`,
|
|
36
|
+
`
|
|
37
|
+
/ \\
|
|
38
|
+
/ šŖ° \\
|
|
39
|
+
/ š·ļø \\
|
|
40
|
+
/_______\\
|
|
41
|
+
| |
|
|
42
|
+
| |
|
|
43
|
+
`
|
|
44
|
+
];
|
|
45
|
+
// Build the web
|
|
46
|
+
for (const frame of frames) {
|
|
47
|
+
console.clear();
|
|
48
|
+
console.log(chalk_1.default.gray(frame));
|
|
49
|
+
await sleep(800);
|
|
50
|
+
}
|
|
51
|
+
await sleep(500);
|
|
52
|
+
console.log(chalk_1.default.white.italic('\n"The example of those who take allies other than Allah..."'));
|
|
53
|
+
await sleep(2500);
|
|
54
|
+
console.log(chalk_1.default.white.italic('"...is that of the spider who builds a house."'));
|
|
55
|
+
await sleep(2500);
|
|
56
|
+
// Crumble animation
|
|
57
|
+
const crumblingFrames = [
|
|
58
|
+
`
|
|
59
|
+
/ \\
|
|
60
|
+
/ šŖ° \\
|
|
61
|
+
/ š·ļø \\
|
|
62
|
+
/_______\\
|
|
63
|
+
| |
|
|
64
|
+
| |
|
|
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
|
+
for (const frame of crumblingFrames) {
|
|
100
|
+
console.clear();
|
|
101
|
+
console.log(chalk_1.default.gray(frame));
|
|
102
|
+
await sleep(400); // Slower crumble to be visible
|
|
103
|
+
}
|
|
104
|
+
console.clear();
|
|
105
|
+
console.log(chalk_1.default.red.bold('\nThe web is gone.'));
|
|
106
|
+
await sleep(1000);
|
|
107
|
+
console.log(chalk_1.default.white.bold('\n"And indeed, the weakest of houses is the house of the spider." (29:41)'));
|
|
108
|
+
console.log(chalk_1.default.gray('\nLesson: Reliance on anything other than Allah is like leaning on a spider web.'));
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const rainParable = {
|
|
112
|
+
name: 'rain',
|
|
113
|
+
surah: 'Al-Baqarah',
|
|
114
|
+
ayah: '2:265',
|
|
115
|
+
title: 'The Heavy Rain',
|
|
116
|
+
animate: async () => {
|
|
117
|
+
console.clear();
|
|
118
|
+
const clouds = `
|
|
119
|
+
āļø āļø āļø
|
|
120
|
+
`;
|
|
121
|
+
console.log(clouds);
|
|
122
|
+
await sleep(1000);
|
|
123
|
+
const rainFrames = [
|
|
124
|
+
`
|
|
125
|
+
āļø āļø āļø
|
|
126
|
+
š§ š§ š§
|
|
127
|
+
`,
|
|
128
|
+
`
|
|
129
|
+
āļø āļø āļø
|
|
130
|
+
|
|
131
|
+
š§ š§ š§
|
|
132
|
+
`,
|
|
133
|
+
`
|
|
134
|
+
āļø āļø āļø
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
š§ š§ š§
|
|
138
|
+
`,
|
|
139
|
+
`
|
|
140
|
+
āļø āļø āļø
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
š± š± š±
|
|
144
|
+
========
|
|
145
|
+
`
|
|
146
|
+
];
|
|
147
|
+
for (let i = 0; i < 4; i++) { // Loop rain a few times
|
|
148
|
+
for (const frame of rainFrames.slice(0, 3)) {
|
|
149
|
+
console.clear();
|
|
150
|
+
console.log(chalk_1.default.blue(frame));
|
|
151
|
+
await sleep(200);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Final growth
|
|
155
|
+
console.clear();
|
|
156
|
+
console.log(chalk_1.default.green(rainFrames[3]));
|
|
157
|
+
await sleep(1000);
|
|
158
|
+
console.log(chalk_1.default.green.bold('\nLife springs forth.'));
|
|
159
|
+
console.log(chalk_1.default.white.italic('\n"And Allah sees what you do. Sincerity makes even small deeds grow like a garden after rain."'));
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
const lightParable = {
|
|
163
|
+
name: 'light',
|
|
164
|
+
surah: 'An-Nur',
|
|
165
|
+
ayah: '24:35',
|
|
166
|
+
title: 'Light upon Light',
|
|
167
|
+
animate: async () => {
|
|
168
|
+
const lampFrames = [
|
|
169
|
+
`
|
|
170
|
+
āØ
|
|
171
|
+
šÆļø
|
|
172
|
+
š”
|
|
173
|
+
š
|
|
174
|
+
`,
|
|
175
|
+
`
|
|
176
|
+
āØ
|
|
177
|
+
šÆļø
|
|
178
|
+
š”
|
|
179
|
+
š
|
|
180
|
+
`,
|
|
181
|
+
`
|
|
182
|
+
āØ
|
|
183
|
+
šÆļø
|
|
184
|
+
š”
|
|
185
|
+
š
|
|
186
|
+
`,
|
|
187
|
+
`
|
|
188
|
+
āØ
|
|
189
|
+
šÆļø
|
|
190
|
+
š”
|
|
191
|
+
š
|
|
192
|
+
`
|
|
193
|
+
];
|
|
194
|
+
console.log(chalk_1.default.white.italic('\n"Allah is the Light of the heavens and the earth."'));
|
|
195
|
+
await sleep(1500);
|
|
196
|
+
for (let i = 0; i < 10; i++) {
|
|
197
|
+
console.clear();
|
|
198
|
+
const frame = lampFrames[i % lampFrames.length];
|
|
199
|
+
// Randomly colorize for flickering effect
|
|
200
|
+
const color = Math.random() > 0.5 ? chalk_1.default.yellow : chalk_1.default.yellowBright;
|
|
201
|
+
console.log(color.bold(frame));
|
|
202
|
+
await sleep(200);
|
|
203
|
+
}
|
|
204
|
+
console.log(chalk_1.default.white.italic('\n"Light upon light. Allah guides to His light whom He wills."'));
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const ropeParable = {
|
|
208
|
+
name: 'rope',
|
|
209
|
+
surah: 'Ali \'Imran',
|
|
210
|
+
ayah: '3:103',
|
|
211
|
+
title: 'The Rope of Allah',
|
|
212
|
+
animate: async () => {
|
|
213
|
+
console.clear();
|
|
214
|
+
const frames = [
|
|
215
|
+
`
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
( ALL )
|
|
221
|
+
\\_______/
|
|
222
|
+
`,
|
|
223
|
+
`
|
|
224
|
+
|
|
|
225
|
+
|
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
( ALL )
|
|
229
|
+
\\_______/
|
|
230
|
+
`,
|
|
231
|
+
`
|
|
232
|
+
|
|
|
233
|
+
|
|
|
234
|
+
|
|
|
235
|
+
|
|
|
236
|
+
( ALL )
|
|
237
|
+
\\_______/
|
|
238
|
+
`,
|
|
239
|
+
`
|
|
240
|
+
|
|
|
241
|
+
|
|
|
242
|
+
/|\\
|
|
243
|
+
/ | \\
|
|
244
|
+
/ | \\
|
|
245
|
+
( š¤ ALL š¤ )
|
|
246
|
+
\\_______/
|
|
247
|
+
`
|
|
248
|
+
];
|
|
249
|
+
for (const frame of frames) {
|
|
250
|
+
console.clear();
|
|
251
|
+
console.log(chalk_1.default.blue(frame));
|
|
252
|
+
await sleep(800);
|
|
253
|
+
}
|
|
254
|
+
await sleep(500);
|
|
255
|
+
console.log(chalk_1.default.yellow('\nImagine if everyone let go... š'));
|
|
256
|
+
await sleep(2000);
|
|
257
|
+
console.log(chalk_1.default.green('\nBut if we hold tight... š¤'));
|
|
258
|
+
await sleep(1000);
|
|
259
|
+
console.log(chalk_1.default.white.italic('\n"And hold firmly to the rope of Allah all together and do not become divided." (3:103)'));
|
|
260
|
+
console.log(chalk_1.default.gray('\nTadabbur: The "Rope" is the Quran/Covenant. Holding it *together* is our only safety from the pit of fire.'));
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const treeParable = {
|
|
264
|
+
name: 'tree',
|
|
265
|
+
surah: 'Ibrahim',
|
|
266
|
+
ayah: '14:24',
|
|
267
|
+
title: 'The Good Tree',
|
|
268
|
+
animate: async () => {
|
|
269
|
+
const frames = [
|
|
270
|
+
`
|
|
271
|
+
. (seed)
|
|
272
|
+
`,
|
|
273
|
+
`
|
|
274
|
+
š±
|
|
275
|
+
`,
|
|
276
|
+
`
|
|
277
|
+
šæ
|
|
278
|
+
|
|
|
279
|
+
`,
|
|
280
|
+
`
|
|
281
|
+
š³
|
|
282
|
+
|
|
|
283
|
+
|
|
|
284
|
+
`,
|
|
285
|
+
`
|
|
286
|
+
š³š³
|
|
287
|
+
||
|
|
288
|
+
||
|
|
289
|
+
root
|
|
290
|
+
`
|
|
291
|
+
];
|
|
292
|
+
for (const frame of frames) {
|
|
293
|
+
console.clear();
|
|
294
|
+
console.log(chalk_1.default.green(frame));
|
|
295
|
+
await sleep(800);
|
|
296
|
+
}
|
|
297
|
+
console.log(chalk_1.default.white.italic('\n"A good word is like a good tree, its root is firm and its branches are in the sky."'));
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const parables = [spiderParable, rainParable, lightParable, ropeParable, treeParable];
|
|
301
|
+
exports.parableCommand = new commander_1.Command('parable')
|
|
302
|
+
.description('Visual Quranic Metaphors (Animated)')
|
|
303
|
+
.argument('[name]', 'Name of the parable (e.g., spider, rain, light)')
|
|
304
|
+
.action(async (name) => {
|
|
305
|
+
(0, printer_1.printCommandHeader)('parable');
|
|
306
|
+
let selectedParable;
|
|
307
|
+
if (name) {
|
|
308
|
+
selectedParable = parables.find(p => p.name.toLowerCase() === name.toLowerCase());
|
|
309
|
+
if (!selectedParable) {
|
|
310
|
+
console.log(chalk_1.default.red('Parable not found.'));
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
const answers = await inquirer_1.default.prompt([
|
|
316
|
+
{
|
|
317
|
+
type: 'list',
|
|
318
|
+
name: 'parable',
|
|
319
|
+
message: 'Choose a parable to visualize:',
|
|
320
|
+
choices: parables.map(p => p.name)
|
|
321
|
+
}
|
|
322
|
+
]);
|
|
323
|
+
selectedParable = parables.find(p => p.name === answers.parable);
|
|
324
|
+
}
|
|
325
|
+
if (selectedParable) {
|
|
326
|
+
console.clear();
|
|
327
|
+
console.log(chalk_1.default.green.bold(`\n${selectedParable.title}`));
|
|
328
|
+
console.log(chalk_1.default.gray(`Surah ${selectedParable.surah} (${selectedParable.ayah})`));
|
|
329
|
+
await sleep(1500);
|
|
330
|
+
await selectedParable.animate();
|
|
331
|
+
}
|
|
332
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.prayersCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
10
|
+
const ora_1 = __importDefault(require("ora"));
|
|
11
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const config_1 = require("../utils/config");
|
|
13
|
+
const printer_1 = require("../utils/printer");
|
|
14
|
+
exports.prayersCommand = new commander_1.Command('prayers')
|
|
15
|
+
.description('Show Prayer Times')
|
|
16
|
+
.option('-c, --config', 'Configure location')
|
|
17
|
+
.action(async (options) => {
|
|
18
|
+
(0, printer_1.printCommandHeader)('prayers');
|
|
19
|
+
let config = (0, config_1.getConfig)();
|
|
20
|
+
if (options.config || !config.location?.city || !config.location?.country) {
|
|
21
|
+
const answers = await inquirer_1.default.prompt([
|
|
22
|
+
{ type: 'input', name: 'city', message: 'Enter your city:', default: config.location?.city },
|
|
23
|
+
{ type: 'input', name: 'country', message: 'Enter your country:', default: config.location?.country }
|
|
24
|
+
]);
|
|
25
|
+
config.location = { city: answers.city, country: answers.country };
|
|
26
|
+
(0, config_1.setConfig)(config);
|
|
27
|
+
}
|
|
28
|
+
const { city, country } = config.location;
|
|
29
|
+
const spinner = (0, ora_1.default)(`Fetching prayer times for ${city}, ${country}...`).start();
|
|
30
|
+
try {
|
|
31
|
+
const response = await axios_1.default.get('http://api.aladhan.com/v1/timingsByCity', {
|
|
32
|
+
params: {
|
|
33
|
+
city,
|
|
34
|
+
country,
|
|
35
|
+
method: 2 // ISNA (can be configurable later)
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
spinner.stop();
|
|
39
|
+
const timings = response.data.data.timings;
|
|
40
|
+
const date = response.data.data.date.readable;
|
|
41
|
+
const hijri = response.data.data.date.hijri;
|
|
42
|
+
console.clear();
|
|
43
|
+
console.log(chalk_1.default.green.bold(`\n Prayer Times for ${city}, ${country}`));
|
|
44
|
+
console.log(chalk_1.default.gray(` ${date} | ${hijri.day} ${hijri.month.en} ${hijri.year}`));
|
|
45
|
+
console.log(chalk_1.default.gray('----------------------------------------'));
|
|
46
|
+
const prayers = [
|
|
47
|
+
{ name: 'Fajr', time: timings.Fajr, icon: '[FAJR]' },
|
|
48
|
+
{ name: 'Sunrise', time: timings.Sunrise, icon: '[SHRQ]' },
|
|
49
|
+
{ name: 'Dhuhr', time: timings.Dhuhr, icon: '[DHUR]' },
|
|
50
|
+
{ name: 'Asr', time: timings.Asr, icon: '[ASR ]' },
|
|
51
|
+
{ name: 'Maghrib', time: timings.Maghrib, icon: '[MAGH]' },
|
|
52
|
+
{ name: 'Isha', time: timings.Isha, icon: '[ISHA]' }
|
|
53
|
+
];
|
|
54
|
+
prayers.forEach(p => {
|
|
55
|
+
console.log(`${p.icon} ${chalk_1.default.bold(p.name.padEnd(10))} ${chalk_1.default.cyan(p.time)}`);
|
|
56
|
+
});
|
|
57
|
+
console.log('');
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
spinner.fail('Failed to fetch prayer times.');
|
|
61
|
+
console.error(chalk_1.default.red('Please check your internet connection or location settings.'));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pullCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
const gems_1 = require("../data/gems");
|
|
11
|
+
const printer_1 = require("../utils/printer");
|
|
12
|
+
exports.pullCommand = new commander_1.Command('pull')
|
|
13
|
+
.description('Pull a random ayah or hadith for reflection')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
(0, printer_1.printCommandHeader)('pull');
|
|
16
|
+
const spinner = (0, ora_1.default)('Fetching divine wisdom...').start();
|
|
17
|
+
// Simulate a small delay for effect
|
|
18
|
+
await new Promise(resolve => setTimeout(resolve, 800));
|
|
19
|
+
const randomGem = gems_1.gems[Math.floor(Math.random() * gems_1.gems.length)];
|
|
20
|
+
spinner.succeed(chalk_1.default.green('Reflection loaded.'));
|
|
21
|
+
console.log('');
|
|
22
|
+
console.log(chalk_1.default.yellow.bold(`"${randomGem.text}"`));
|
|
23
|
+
console.log(chalk_1.default.gray(`ā ${randomGem.source}`));
|
|
24
|
+
console.log('');
|
|
25
|
+
console.log(chalk_1.default.blue.bold('Language Gem:'));
|
|
26
|
+
console.log(chalk_1.default.white(randomGem.reflection));
|
|
27
|
+
console.log('');
|
|
28
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pushCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const printer_1 = require("../utils/printer");
|
|
13
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
14
|
+
// Store Duas in the local project scope (like Pull Requests)
|
|
15
|
+
const DUA_FILE = path_1.default.join(process.cwd(), '.aya', 'duas.json');
|
|
16
|
+
exports.pushCommand = new commander_1.Command('push')
|
|
17
|
+
.description('Push goodness to the world (Sadaqah/Du\'a) or your Dua Jar')
|
|
18
|
+
.action(async () => {
|
|
19
|
+
(0, printer_1.printCommandHeader)('push');
|
|
20
|
+
const choices = [
|
|
21
|
+
{ name: 'š Push to Origin Jannah (Daily Sadaqah/Deed)', value: 'sadaqah' },
|
|
22
|
+
{ name: 'šŗ Push to Dua Jar (My Personal PRs)', value: 'dua' }
|
|
23
|
+
];
|
|
24
|
+
const { mode } = await inquirer_1.default.prompt([
|
|
25
|
+
{
|
|
26
|
+
type: 'list',
|
|
27
|
+
name: 'mode',
|
|
28
|
+
message: 'Select your push target:',
|
|
29
|
+
choices
|
|
30
|
+
}
|
|
31
|
+
]);
|
|
32
|
+
if (mode === 'sadaqah') {
|
|
33
|
+
showDailyDeed();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
await handleDuaJar();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
function showDailyDeed() {
|
|
40
|
+
console.log(chalk_1.default.green.bold('\nš Pushing to origin jannah...'));
|
|
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
|
+
const randomAction = actions[Math.floor(Math.random() * actions.length)];
|
|
68
|
+
console.log((0, boxen_1.default)(chalk_1.default.white(`Action item: ${chalk_1.default.bold(randomAction.text)}`) + '\n' +
|
|
69
|
+
chalk_1.default.gray(randomAction.link), {
|
|
70
|
+
padding: 1,
|
|
71
|
+
margin: 1,
|
|
72
|
+
borderStyle: 'round',
|
|
73
|
+
borderColor: 'yellow',
|
|
74
|
+
title: 'Daily Sadaqah Commit',
|
|
75
|
+
titleAlignment: 'center'
|
|
76
|
+
}));
|
|
77
|
+
console.log(chalk_1.default.yellow('Your code is temporary. Your impact is eternal.'));
|
|
78
|
+
}
|
|
79
|
+
async function handleDuaJar() {
|
|
80
|
+
const { action } = await inquirer_1.default.prompt([
|
|
81
|
+
{
|
|
82
|
+
type: 'list',
|
|
83
|
+
name: 'action',
|
|
84
|
+
message: 'Dua Jar Options:',
|
|
85
|
+
choices: [
|
|
86
|
+
{ name: 'š Add a new Dua (Open PR)', value: 'add' },
|
|
87
|
+
{ name: '𤲠Pull a random Dua (Review)', value: 'pull' },
|
|
88
|
+
{ name: 'š List all Duas (Log)', value: 'list' }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]);
|
|
92
|
+
const duas = loadDuas();
|
|
93
|
+
if (action === 'add') {
|
|
94
|
+
const { duaText } = await inquirer_1.default.prompt([
|
|
95
|
+
{
|
|
96
|
+
type: 'input',
|
|
97
|
+
name: 'duaText',
|
|
98
|
+
message: 'Write your dua here:'
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
if (duaText.trim()) {
|
|
102
|
+
duas.push({
|
|
103
|
+
text: duaText,
|
|
104
|
+
date: new Date().toISOString()
|
|
105
|
+
});
|
|
106
|
+
saveDuas(duas);
|
|
107
|
+
console.log(chalk_1.default.green('\nā
Dua pushed to the jar. May Allah accept it.'));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (action === 'pull') {
|
|
111
|
+
if (duas.length === 0) {
|
|
112
|
+
console.log(chalk_1.default.yellow('\nYour Dua Jar is empty. Add some duas first!'));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
const randomDua = duas[Math.floor(Math.random() * duas.length)];
|
|
116
|
+
console.log((0, boxen_1.default)(chalk_1.default.white.bold(`"${randomDua.text}"`) + '\n\n' +
|
|
117
|
+
chalk_1.default.gray(`(Added on ${new Date(randomDua.date).toLocaleDateString()})`), {
|
|
118
|
+
padding: 1,
|
|
119
|
+
margin: 1,
|
|
120
|
+
borderStyle: 'double',
|
|
121
|
+
borderColor: 'cyan',
|
|
122
|
+
title: '⨠A Dua from your Jar',
|
|
123
|
+
titleAlignment: 'center'
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else if (action === 'list') {
|
|
128
|
+
if (duas.length === 0) {
|
|
129
|
+
console.log(chalk_1.default.yellow('\nYour Dua Jar is empty.'));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
console.log(chalk_1.default.cyan('\nš Your Saved Duas:'));
|
|
133
|
+
duas.forEach((d, i) => {
|
|
134
|
+
console.log(chalk_1.default.white(`${i + 1}. ${d.text}`));
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function loadDuas() {
|
|
140
|
+
if (fs_1.default.existsSync(DUA_FILE)) {
|
|
141
|
+
try {
|
|
142
|
+
return JSON.parse(fs_1.default.readFileSync(DUA_FILE, 'utf-8'));
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
function saveDuas(duas) {
|
|
151
|
+
const dir = path_1.default.dirname(DUA_FILE);
|
|
152
|
+
if (!fs_1.default.existsSync(dir)) {
|
|
153
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
154
|
+
}
|
|
155
|
+
fs_1.default.writeFileSync(DUA_FILE, JSON.stringify(duas, null, 2));
|
|
156
|
+
}
|