@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
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Contributing to the Book of Deeds 📚
|
|
2
|
+
|
|
3
|
+
> "When a person dies, his deeds come to an end except for three: Sadaqah Jariyah (a continuous charity), or knowledge from which benefit is gained, or a righteous child who prays for him." (Muslim)
|
|
4
|
+
|
|
5
|
+
Assalamu Alaikum wa Rahmatullah wa Barakatuh! 👋
|
|
6
|
+
|
|
7
|
+
We are incredibly humbled that you want to contribute to `aya`. Think of every line of code you write here as a form of **Sadaqah Jariyah**—knowledge that will benefit others long after we are gone.
|
|
8
|
+
|
|
9
|
+
Whether you're fixing a bug (removing a bad habit), adding a feature (learning a new Sunnah), or improving documentation (sharing Ilm), your efforts are recorded not just in `git log`, but in a Record far more permanent.
|
|
10
|
+
|
|
11
|
+
## 🌟 The Code of Conduct (Adab)
|
|
12
|
+
|
|
13
|
+
Just as we have Adab in our daily lives, we have Adab in our code:
|
|
14
|
+
|
|
15
|
+
1. **Ikhlas (Sincerity)**: Code with the intention to help others.
|
|
16
|
+
2. **Ihsan (Excellence)**: Write clean, readable, and efficient code. "Allah has prescribed Ihsan in all things."
|
|
17
|
+
3. **Respect**: Treat fellow contributors with kindness and patience.
|
|
18
|
+
|
|
19
|
+
## 🛠️ How to Contribute
|
|
20
|
+
|
|
21
|
+
1. **Fork the Repository**: Create your own copy of the project.
|
|
22
|
+
2. **Create a Branch**: `git checkout -b feature/amazing-feature`.
|
|
23
|
+
3. **Code with Ihsan**: Implement your changes.
|
|
24
|
+
4. **Test**: Ensure your changes don't break existing functionality.
|
|
25
|
+
5. **Commit**: `git commit -m "feat: Add new prayer time calculation"`.
|
|
26
|
+
6. **Push**: `git push origin feature/amazing-feature`.
|
|
27
|
+
7. **Open a Pull Request**: Submit your PR (Make a Dua for its acceptance!).
|
|
28
|
+
|
|
29
|
+
## 🐛 Found a Bug?
|
|
30
|
+
|
|
31
|
+
If you find a bug, please open an issue. Consider it a form of *Naseehah* (advice) to the maintainers. Be gentle in your description, and we will try our best to fix it InshaAllah.
|
|
32
|
+
|
|
33
|
+
## 💡 Feature Requests
|
|
34
|
+
|
|
35
|
+
Have an idea to make this tool better for the Ummah? Open an issue and let's discuss! We love hearing how we can improve.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
May Allah accept your contributions and place them heavy on your scale of good deeds. Ameen.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shajedul Karim
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# aya
|
|
2
|
+
|
|
3
|
+
> "And We have fastened every man's deeds to his neck, and on the Day of Resurrection, We shall bring out for him a book which he will find wide open." (17:13)
|
|
4
|
+
|
|
5
|
+
Listen, we need to talk.
|
|
6
|
+
|
|
7
|
+
We live in a world of inputs and outputs. We spend our days in the terminal, typing commands, expecting results, fixing bugs, and pushing code. We are obsessed with our GitHub contribution graphs. We worry about our commit history. We stress over merge conflicts.
|
|
8
|
+
|
|
9
|
+
**But have you ever stopped to think?**
|
|
10
|
+
|
|
11
|
+
What about the repository of your life? What about the "issues" in your heart that have been open for years? What about the "commits" that the Angels are recording right now, at this very second?
|
|
12
|
+
|
|
13
|
+
That's why we built **aya**.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 💡 The "Insider" Story: Why We Built This
|
|
18
|
+
|
|
19
|
+
You want to know the truth? This isn't just another developer tool. It’s a response to a modern problem.
|
|
20
|
+
|
|
21
|
+
We live in a time where we are hyper-connected to our repositories but disconnected from our purpose. We track every line of code, but we lose track of our spiritual state.
|
|
22
|
+
|
|
23
|
+
We realized something profound: **We are optimizing our code, but we are not optimizing our lives.**
|
|
24
|
+
|
|
25
|
+
The idea is simple yet radical: What if the very tools we use to build the dunya could be used to build our akhirah? What if `git status` could remind you of your status with Allah?
|
|
26
|
+
|
|
27
|
+
That is why **aya** exists. It is a bridge. It takes the language you already know—`git`, `status`, `push`, `pull`—and reorients it to help you track the most important project you will ever work on: **Your Soul.**
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## ❓ Why "aya"?
|
|
32
|
+
|
|
33
|
+
People ask me, "Why did you call it aya?"
|
|
34
|
+
|
|
35
|
+
Look at the linguistics. In Arabic, **Ayah** (آية) doesn't just mean a "verse" of the Quran. It means a **Sign**. It means a **Miracle**. It means **Evidence**.
|
|
36
|
+
|
|
37
|
+
Every line of code you write can be an *ayah*—a sign of Allah's perfection. Every bug you fix can be a lesson. The sun is an ayah. The wind is an ayah. And this tool? It's a humble attempt to turn your terminal into a series of *ayat*—reminders that point you back to Him.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 🚀 Quick Start (Bismillah)
|
|
42
|
+
|
|
43
|
+
You want to get started? Bismillah. It’s simple.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 1. Install it globally (make it part of your system)
|
|
47
|
+
npm install -g @ihsandeen/aya
|
|
48
|
+
|
|
49
|
+
# 2. Set your intention (Niyyah) for the session
|
|
50
|
+
aya init
|
|
51
|
+
|
|
52
|
+
# 3. Check your connection to the Heavens
|
|
53
|
+
aya status
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🔄 The Workflow (The Real Daily Grind)
|
|
59
|
+
|
|
60
|
+
You see, the life of a believer is a constant cycle. It's not a straight line. We mapped this spiritual reality to your developer workflow.
|
|
61
|
+
|
|
62
|
+
| Command | The Spiritual Reality (The "Why") |
|
|
63
|
+
| :--- | :--- |
|
|
64
|
+
| `aya init` | **Niyyah (Intention)**<br>Before you write a single line of code, ask yourself: *Who is this for?* If it's for ego, it's wasted. If it's for Allah, even a `console.log` becomes worship. This command sets that frame. |
|
|
65
|
+
| `aya status` | **Salah & Connection Check**<br>You run `git status` to see changed files. `aya status` checks your *connection to the Divine*. It tells you: "Your heart is currently on branch 'dunya'." It checks if you've missed prayers. It's a reality check. Are you online with Allah, or did you timeout? |
|
|
66
|
+
| `aya diff` | **The Precision of Divine Speech**<br>This isn't comparing two files. This is comparing *words*. Why did Allah use *this* specific word here and not its synonym? `aya diff` challenges you with linguistic nuances. It shows you that the Quran isn't just poetry; it's precision engineering. |
|
|
67
|
+
| `aya commit` | **Amal (Deed)**<br>Every smile, every charity, every moment of patience—that's a commit. And unlike git, you can't `reset --hard` these commits once the time passes. Make them count. |
|
|
68
|
+
| `aya push` | **Dua (Supplication)**<br>You have anxieties? You have bugs you can't fix? Push them up. The Server is always listening. The bandwidth is infinite. |
|
|
69
|
+
| `aya pull` | **Rizq (Provision)**<br>We think we generate success. No. We just pull from the provision that was already written. Ask for guidance, and pull it down. |
|
|
70
|
+
| `aya blame` | **Nafs (Self-Reproach)**<br>When code breaks, we check `git blame` to find the culprit. The believer looks in the mirror. *Nafs al-Lawwama*—the self-reproaching soul. It's healthy to admit your faults. |
|
|
71
|
+
| `aya repo` | **Kitab (Book of Deeds)**<br>Imagine if you could see your Book of Deeds right now. This command opens a UI to visualize your spiritual contributions. It's eye-opening. |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 🛠️ The Toolkit (Equip Yourself)
|
|
76
|
+
|
|
77
|
+
A believer doesn't go into the battlefield unarmed. You need tools. You need reminders.
|
|
78
|
+
|
|
79
|
+
### 🕌 Worship & Practice
|
|
80
|
+
| Command | Why you need this |
|
|
81
|
+
| :--- | :--- |
|
|
82
|
+
| `aya prayers` | Because *Salah* is the anchor. If this slips, everything slips. |
|
|
83
|
+
| `aya qibla` | Wherever you are, you need to know which way is Home 🕋. |
|
|
84
|
+
| `aya adhan` | Sometimes we get so lost in the code, we need a call to come back to success. |
|
|
85
|
+
| `aya wudu` | It's not just washing limbs. It's washing away the minor sins of the last few hours. |
|
|
86
|
+
| `aya tasbih` | Keep your tongue moist. It's light on the tongue, heavy on the scale. |
|
|
87
|
+
| `aya fast` | Discipline the body to feed the soul. It's a detox. |
|
|
88
|
+
| `aya zakat` | Your wealth isn't yours. You're just the manager. Purify it. |
|
|
89
|
+
| `aya friday` | The best day the sun has risen upon. Don't treat it like just another Friday. |
|
|
90
|
+
|
|
91
|
+
### 📖 Knowledge & Reflection (Tadabbur)
|
|
92
|
+
| Command | Why you need this |
|
|
93
|
+
| :--- | :--- |
|
|
94
|
+
| `aya tafsir` | Don't just read the Quran. *Understand* it. Dive deep. |
|
|
95
|
+
| `aya memorize` | Carrying the Words of Allah in your chest is a protection. |
|
|
96
|
+
| `aya seek` | Knowledge is an ocean. Start swimming. |
|
|
97
|
+
| `aya names` | You can't love someone you don't know. Learn His Names. |
|
|
98
|
+
| `aya parable` | Allah uses metaphors so we can understand complex realities. |
|
|
99
|
+
| `aya history` | We stand on the shoulders of giants. Know your legacy. |
|
|
100
|
+
| `aya hero` | The Sahaba were real people with real struggles. Learn from them. |
|
|
101
|
+
| `aya sunnah` | The Prophet (pbuh) was the walking Quran. Follow his footsteps. |
|
|
102
|
+
|
|
103
|
+
### 🧠 Mindset & Character
|
|
104
|
+
| Command | Why you need this |
|
|
105
|
+
| :--- | :--- |
|
|
106
|
+
| `aya journal` | Writing is a way to shackle fleeting wisdom. Document your journey. |
|
|
107
|
+
| `aya sabr` | Patience isn't passive. It's active endurance. It's grit. |
|
|
108
|
+
| `aya shukr` | Gratitude is the key to increase. You want more? Be grateful. |
|
|
109
|
+
| `aya adab` | You can have all the knowledge, but if you have no manners, you have nothing. |
|
|
110
|
+
| `aya invest` | "Shall I tell you of a trade that will save you?" Invest in your Akhirah. |
|
|
111
|
+
| `aya sleep` | Even your sleep can be worship. Prepare for the minor death. |
|
|
112
|
+
|
|
113
|
+
### 🌍 World & Signs (Ayat)
|
|
114
|
+
| Command | Why you need this |
|
|
115
|
+
| :--- | :--- |
|
|
116
|
+
| `aya nature` | Look at the sky. Look at the trees. They are all submitting. Are you? |
|
|
117
|
+
| `aya anatomy` | Look at your own hands. The complexity is a sign of the Designer. |
|
|
118
|
+
| `aya scene` | Visualize the Day of Judgment. It puts your compile errors in perspective. |
|
|
119
|
+
| `aya lens` | Shift your perspective. See the world through the lens of the Believer. |
|
|
120
|
+
| `aya mirror` | The believer is a mirror to his brother. What do you reflect? |
|
|
121
|
+
| `aya sound` | Let the recitation of the Quran soothe your heart. |
|
|
122
|
+
| `aya hijri` | Step out of the Gregorian construct. Live by the moon. |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 🤝 Contributing (Sadaqah Jariyah)
|
|
127
|
+
|
|
128
|
+
Listen, this project isn't about me. It's about *us*. It's a **Sadaqah Jariyah**—a continuing charity. Imagine someone using this tool and remembering Allah because of a line of code you wrote. That's a reward that continues even after you're gone.
|
|
129
|
+
|
|
130
|
+
**Want to earn that reward?** 👇
|
|
131
|
+
|
|
132
|
+
1. **Clone it**: `git clone https://github.com/ihsandeen/aya.git`
|
|
133
|
+
2. **Install it**: `npm install`
|
|
134
|
+
3. **Build it**: `npm run build`
|
|
135
|
+
4. **Link it**: `npm link`
|
|
136
|
+
|
|
137
|
+
If you find a bug, fix it. If you have an idea, build it. Do it with *Ihsan* (excellence).
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
*May Allah accept this humble effort from us and make it a witness for us on the Day of Judgment.* 🤲
|
|
@@ -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.adabCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const nak_1 = require("../data/nak");
|
|
11
|
+
const printer_1 = require("../utils/printer");
|
|
12
|
+
exports.adabCommand = new commander_1.Command('adab')
|
|
13
|
+
.description('The Manners Engine (Relationships)')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
(0, printer_1.printCommandHeader)('adab');
|
|
16
|
+
const { relation } = await inquirer_1.default.prompt([{
|
|
17
|
+
type: 'list',
|
|
18
|
+
name: 'relation',
|
|
19
|
+
message: 'Select a relationship to improve:',
|
|
20
|
+
choices: nak_1.adabData.map(r => r.relation)
|
|
21
|
+
}]);
|
|
22
|
+
const data = nak_1.adabData.find(r => r.relation === relation);
|
|
23
|
+
if (data) {
|
|
24
|
+
console.log(chalk_1.default.blue.bold(`\n Relationship: ${data.relation}`));
|
|
25
|
+
console.log(chalk_1.default.yellow(` Quranic Keyword: ${data.arabicKeyword} (${data.meaning})`));
|
|
26
|
+
console.log(chalk_1.default.white(` Practice: ${data.practice}\n`));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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.adhanCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const ora_1 = __importDefault(require("ora"));
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
11
|
+
const os_1 = __importDefault(require("os"));
|
|
12
|
+
const printer_1 = require("../utils/printer");
|
|
13
|
+
exports.adhanCommand = new commander_1.Command('adhan')
|
|
14
|
+
.description('Call to Prayer (Adhan) - Plays audio or shows text')
|
|
15
|
+
.option('-s, --silent', 'Show text only, do not play audio')
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
(0, printer_1.printCommandHeader)('adhan');
|
|
18
|
+
console.log(chalk_1.default.green.bold('\n Allahu Akbar, Allahu Akbar\n'));
|
|
19
|
+
const lines = [
|
|
20
|
+
{ arabic: 'الله أكبر الله أكبر', translation: 'God is the Greatest, God is the Greatest' },
|
|
21
|
+
{ arabic: 'أشهد أن لا إله إلا الله', translation: 'I bear witness that there is no god except God' },
|
|
22
|
+
{ arabic: 'أشهد أن محمدا رسول الله', translation: 'I bear witness that Muhammad is the Messenger of God' },
|
|
23
|
+
{ arabic: 'حي على الصلاة', translation: 'Hasten to the prayer' },
|
|
24
|
+
{ arabic: 'حي على الفلاح', translation: 'Hasten to success' },
|
|
25
|
+
{ arabic: 'الله أكبر الله أكبر', translation: 'God is the Greatest, God is the Greatest' },
|
|
26
|
+
{ arabic: 'لا إله إلا الله', translation: 'There is no god except God' }
|
|
27
|
+
];
|
|
28
|
+
// Print Adhan beautifully with delays
|
|
29
|
+
for (const line of lines) {
|
|
30
|
+
console.log(chalk_1.default.yellow.bold(line.arabic));
|
|
31
|
+
console.log(chalk_1.default.gray(line.translation));
|
|
32
|
+
console.log('');
|
|
33
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
34
|
+
}
|
|
35
|
+
if (!options.silent) {
|
|
36
|
+
const spinner = (0, ora_1.default)('Playing Adhan...').start();
|
|
37
|
+
// Attempt to play a system sound
|
|
38
|
+
try {
|
|
39
|
+
if (os_1.default.platform() === 'darwin') {
|
|
40
|
+
// macOS
|
|
41
|
+
(0, child_process_1.exec)('afplay /System/Library/Sounds/Glass.aiff');
|
|
42
|
+
}
|
|
43
|
+
else if (os_1.default.platform() === 'linux') {
|
|
44
|
+
// Linux (try paplay or aplay)
|
|
45
|
+
(0, child_process_1.exec)('paplay /usr/share/sounds/freedesktop/stereo/complete.oga || aplay /usr/share/sounds/alsa/Front_Center.wav');
|
|
46
|
+
}
|
|
47
|
+
else if (os_1.default.platform() === 'win32') {
|
|
48
|
+
// Windows
|
|
49
|
+
// PowerShell beep
|
|
50
|
+
(0, child_process_1.exec)('powershell -c "(New-Object Media.SoundPlayer \'C:\\Windows\\Media\\notify.wav\').PlaySync();"');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
// Ignore errors if sound fails
|
|
55
|
+
}
|
|
56
|
+
spinner.succeed('Adhan completed.');
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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.anatomyCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const nak_1 = require("../data/nak");
|
|
11
|
+
const printer_1 = require("../utils/printer");
|
|
12
|
+
exports.anatomyCommand = new commander_1.Command('anatomy')
|
|
13
|
+
.description('The Spiritual Function of Body Parts')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
(0, printer_1.printCommandHeader)('anatomy');
|
|
16
|
+
const { part } = await inquirer_1.default.prompt([{
|
|
17
|
+
type: 'list',
|
|
18
|
+
name: 'part',
|
|
19
|
+
message: 'Select a body part to understand its spiritual role:',
|
|
20
|
+
choices: nak_1.anatomyData.map(p => p.part)
|
|
21
|
+
}]);
|
|
22
|
+
const data = nak_1.anatomyData.find(p => p.part === part);
|
|
23
|
+
if (data) {
|
|
24
|
+
console.log(chalk_1.default.blue.bold(`\n ${data.part} (${data.arabic})`));
|
|
25
|
+
console.log(chalk_1.default.white(` Function: ${data.function}`));
|
|
26
|
+
console.log(chalk_1.default.green(` Spiritual Role: ${data.spiritualRole}`));
|
|
27
|
+
console.log(chalk_1.default.gray(`\n Reflection:\n ${data.reflection}\n`));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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.blameCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const printer_1 = require("../utils/printer");
|
|
10
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
11
|
+
exports.blameCommand = new commander_1.Command('blame')
|
|
12
|
+
.description('Self-reflection tool (Muhasabah)')
|
|
13
|
+
.action(() => {
|
|
14
|
+
(0, printer_1.printCommandHeader)('blame');
|
|
15
|
+
console.log((0, boxen_1.default)(chalk_1.default.red.bold(' git blame? No. ') + '\n' +
|
|
16
|
+
chalk_1.default.yellow(" It wasn't the compiler. It wasn't the PM. ") + '\n\n' +
|
|
17
|
+
chalk_1.default.white.italic('"Nay, man is evidence against himself." (75:14)'), {
|
|
18
|
+
padding: 1,
|
|
19
|
+
margin: 1,
|
|
20
|
+
borderStyle: 'double',
|
|
21
|
+
borderColor: 'red',
|
|
22
|
+
title: 'Muhasabah (Self-Audit)',
|
|
23
|
+
titleAlignment: 'center'
|
|
24
|
+
}));
|
|
25
|
+
console.log(chalk_1.default.cyan(' ➜ Take a breath.'));
|
|
26
|
+
console.log(chalk_1.default.cyan(' ➜ Say Astaghfirullah.'));
|
|
27
|
+
console.log(chalk_1.default.cyan(' ➜ Debug with a clear heart.'));
|
|
28
|
+
console.log('');
|
|
29
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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.commitCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const printer_1 = require("../utils/printer");
|
|
11
|
+
const logger_1 = require("../utils/logger");
|
|
12
|
+
exports.commitCommand = new commander_1.Command('commit')
|
|
13
|
+
.description('Commit a good deed or intention')
|
|
14
|
+
.option('-m, --message <message>', 'The deed you commit to')
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
(0, printer_1.printCommandHeader)('commit');
|
|
17
|
+
let message = options.message;
|
|
18
|
+
if (!message) {
|
|
19
|
+
const answers = await inquirer_1.default.prompt([
|
|
20
|
+
{
|
|
21
|
+
type: 'input',
|
|
22
|
+
name: 'message',
|
|
23
|
+
message: 'What good deed are you committing to today?',
|
|
24
|
+
validate: (input) => input.length > 0 ? true : 'Please enter a valid commitment.'
|
|
25
|
+
}
|
|
26
|
+
]);
|
|
27
|
+
message = answers.message;
|
|
28
|
+
}
|
|
29
|
+
// Log the commit using our new utility
|
|
30
|
+
const commit = logger_1.logger.logCommit(message);
|
|
31
|
+
const totalDeeds = logger_1.logger.getTotalDeeds();
|
|
32
|
+
// NAK Style Output
|
|
33
|
+
console.log(chalk_1.default.gray(`[main ${commit.hash}] Commit confirmed.`));
|
|
34
|
+
console.log(chalk_1.default.green(' Angels are recording. 📝'));
|
|
35
|
+
console.log(chalk_1.default.cyan(` + 1 good deed added to your scale.`));
|
|
36
|
+
// Encouragement based on total deeds
|
|
37
|
+
let encouragement = "";
|
|
38
|
+
if (totalDeeds % 10 === 0)
|
|
39
|
+
encouragement = chalk_1.default.yellow.bold(" MashaAllah! A milestone reached!");
|
|
40
|
+
else if (totalDeeds === 1)
|
|
41
|
+
encouragement = chalk_1.default.yellow.bold(" Bismillah! Your first step.");
|
|
42
|
+
console.log(chalk_1.default.white(` Total good deeds recorded: ${chalk_1.default.bold(totalDeeds)}`) + encouragement);
|
|
43
|
+
console.log(chalk_1.default.dim('\n"Verily, the good deeds remove the evil deeds." (11:114)'));
|
|
44
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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.diffCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const nak_1 = require("../data/nak");
|
|
11
|
+
const printer_1 = require("../utils/printer");
|
|
12
|
+
exports.diffCommand = new commander_1.Command('diff')
|
|
13
|
+
.description('The "Almost" Word (Synonym Challenge)')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
(0, printer_1.printCommandHeader)('diff');
|
|
16
|
+
console.clear();
|
|
17
|
+
console.log(chalk_1.default.yellow.bold('\n Aya Diff: The Precision of Divine Speech'));
|
|
18
|
+
console.log(chalk_1.default.gray('Why did Allah use *this* word and not *that* one?\n'));
|
|
19
|
+
// Select a random challenge or iterate? Let's just pick one for now or loop.
|
|
20
|
+
// Let's loop through all available challenges.
|
|
21
|
+
for (const challenge of nak_1.diffData) {
|
|
22
|
+
console.log(chalk_1.default.white.bold(`Prompt: "${challenge.prompt}"`));
|
|
23
|
+
const answer = await inquirer_1.default.prompt([{
|
|
24
|
+
type: 'list',
|
|
25
|
+
name: 'choice',
|
|
26
|
+
message: 'Which word is used in the Quran?',
|
|
27
|
+
choices: challenge.options.map(o => ({
|
|
28
|
+
name: o.label,
|
|
29
|
+
value: o.value
|
|
30
|
+
}))
|
|
31
|
+
}]);
|
|
32
|
+
const selected = challenge.options.find(o => o.value === answer.choice);
|
|
33
|
+
const isCorrect = selected?.isCorrect;
|
|
34
|
+
if (isCorrect) {
|
|
35
|
+
console.log(chalk_1.default.green.bold('\n Correct!'));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log(chalk_1.default.red.bold(`\n Not quite. The Quran uses: ${challenge.reveal}`));
|
|
39
|
+
}
|
|
40
|
+
console.log(chalk_1.default.cyan.italic(`\n Lesson: ${challenge.lesson}`));
|
|
41
|
+
console.log(chalk_1.default.gray('----------------------------------------\n'));
|
|
42
|
+
// Pause before next?
|
|
43
|
+
const { next } = await inquirer_1.default.prompt([{
|
|
44
|
+
type: 'confirm',
|
|
45
|
+
name: 'next',
|
|
46
|
+
message: 'Next challenge?',
|
|
47
|
+
default: true
|
|
48
|
+
}]);
|
|
49
|
+
if (!next)
|
|
50
|
+
break;
|
|
51
|
+
console.clear();
|
|
52
|
+
}
|
|
53
|
+
console.log(chalk_1.default.yellow('End of challenges. SubhanAllah!'));
|
|
54
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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.duaCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const nak_1 = require("../data/nak");
|
|
11
|
+
const printer_1 = require("../utils/printer");
|
|
12
|
+
exports.duaCommand = new commander_1.Command('dua')
|
|
13
|
+
.description('Prophetic Duas with Context & Backstory')
|
|
14
|
+
.action(async () => {
|
|
15
|
+
(0, printer_1.printCommandHeader)('dua');
|
|
16
|
+
const { situation } = await inquirer_1.default.prompt([{
|
|
17
|
+
type: 'list',
|
|
18
|
+
name: 'situation',
|
|
19
|
+
message: 'What are you feeling / facing?',
|
|
20
|
+
choices: nak_1.duaData.map(d => ({ name: d.situation, value: d }))
|
|
21
|
+
}]);
|
|
22
|
+
displayDua(situation);
|
|
23
|
+
});
|
|
24
|
+
function displayDua(dua) {
|
|
25
|
+
console.clear();
|
|
26
|
+
console.log(chalk_1.default.yellow.bold(`\n The Dua of ${dua.prophet}`));
|
|
27
|
+
console.log(chalk_1.default.gray(` Situation: ${dua.situation}\n`));
|
|
28
|
+
console.log(chalk_1.default.cyan.bold(' The Backstory (Context):'));
|
|
29
|
+
console.log(chalk_1.default.white(` ${dua.context}\n`));
|
|
30
|
+
console.log(chalk_1.default.green.bold(` "${dua.arabic}"`));
|
|
31
|
+
console.log(chalk_1.default.white.italic(` "${dua.translation}"\n`));
|
|
32
|
+
console.log(chalk_1.default.magenta.bold(' The Gem:'));
|
|
33
|
+
console.log(chalk_1.default.white(` ${dua.gem}\n`));
|
|
34
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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.fastCommand = 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.fastCommand = new commander_1.Command('fast')
|
|
12
|
+
.description('Sunnah Fasting Reminders & Spiritual Why')
|
|
13
|
+
.action(async () => {
|
|
14
|
+
(0, printer_1.printCommandHeader)('fast');
|
|
15
|
+
console.clear();
|
|
16
|
+
console.log(chalk_1.default.green.bold('\n The Shield of Fasting (As-Sawm)\n'));
|
|
17
|
+
const today = new Date();
|
|
18
|
+
const day = today.getDay(); // 0 = Sun, 1 = Mon, 4 = Thu
|
|
19
|
+
// Check if tomorrow is Mon (1) or Thu (4)
|
|
20
|
+
const isSunnahTomorrow = day === 0 || day === 3;
|
|
21
|
+
const isSunnahToday = day === 1 || day === 4;
|
|
22
|
+
if (isSunnahToday) {
|
|
23
|
+
console.log(chalk_1.default.yellow.bold(' Today is a Sunnah fasting day! (Monday/Thursday)'));
|
|
24
|
+
console.log(chalk_1.default.gray(' "The gates of Paradise are opened..."\n'));
|
|
25
|
+
}
|
|
26
|
+
else if (isSunnahTomorrow) {
|
|
27
|
+
console.log(chalk_1.default.cyan.bold(' Tomorrow is a Sunnah fasting day! Prepare your Suhoor.'));
|
|
28
|
+
}
|
|
29
|
+
console.log(chalk_1.default.white.bold(' Why we fast (beyond Ramadan):'));
|
|
30
|
+
nak_1.fastData.forEach(f => {
|
|
31
|
+
console.log(chalk_1.default.blue.bold(`\n ${f.type} (${f.when})`));
|
|
32
|
+
console.log(chalk_1.default.white(` Reward: ${f.reward}`));
|
|
33
|
+
console.log(chalk_1.default.gray.italic(` "${f.spiritualWhy}"`));
|
|
34
|
+
});
|
|
35
|
+
console.log('\n');
|
|
36
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
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.fridayCommand = 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.fridayCommand = new commander_1.Command('friday')
|
|
12
|
+
.description('The Jumu\'ah Manager')
|
|
13
|
+
.action(() => {
|
|
14
|
+
(0, printer_1.printCommandHeader)('friday');
|
|
15
|
+
console.log(chalk_1.default.cyan.bold('\n Friday (Jumu\'ah) Checklist & Reflections\n'));
|
|
16
|
+
nak_1.fridayData.forEach((item) => {
|
|
17
|
+
console.log(chalk_1.default.blue.bold(` [ ] ${item.item}`));
|
|
18
|
+
console.log(chalk_1.default.white(` Significance: ${item.significance}`));
|
|
19
|
+
console.log(chalk_1.default.gray(` Deep Dive: ${item.nakNote}\n`));
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
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.heroCommand = void 0;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
+
const nak_1 = require("../data/nak");
|
|
11
|
+
const printer_1 = require("../utils/printer");
|
|
12
|
+
const drawBar = (val, max = 10) => {
|
|
13
|
+
// Use simple ASCII blocks if needed, but standard ones are fine
|
|
14
|
+
const filledChar = '█';
|
|
15
|
+
const emptyChar = '░';
|
|
16
|
+
const filled = filledChar.repeat(val);
|
|
17
|
+
const empty = emptyChar.repeat(max - val);
|
|
18
|
+
// Color logic
|
|
19
|
+
let color = chalk_1.default.red;
|
|
20
|
+
if (val >= 8)
|
|
21
|
+
color = chalk_1.default.green;
|
|
22
|
+
else if (val >= 5)
|
|
23
|
+
color = chalk_1.default.yellow;
|
|
24
|
+
return `${color(filled)}${chalk_1.default.gray(empty)} ${val}/${max}`;
|
|
25
|
+
};
|
|
26
|
+
exports.heroCommand = new commander_1.Command('hero')
|
|
27
|
+
.description('The Prophet Profile (RPG Character Sheet)')
|
|
28
|
+
.argument('[name]', 'Name of the Prophet (e.g. Musa)')
|
|
29
|
+
.action(async (name) => {
|
|
30
|
+
(0, printer_1.printCommandHeader)('hero');
|
|
31
|
+
let data = name
|
|
32
|
+
? nak_1.heroData.find(h => h.name.toLowerCase().includes(name.toLowerCase()))
|
|
33
|
+
: null;
|
|
34
|
+
if (!data && name) {
|
|
35
|
+
console.log(chalk_1.default.red('Profile not found for that Prophet.'));
|
|
36
|
+
}
|
|
37
|
+
if (!data) {
|
|
38
|
+
const { choice } = await inquirer_1.default.prompt([{
|
|
39
|
+
type: 'list',
|
|
40
|
+
name: 'choice',
|
|
41
|
+
message: 'Select a Prophet to view profile:',
|
|
42
|
+
choices: nak_1.heroData.map(h => ({
|
|
43
|
+
name: h.name,
|
|
44
|
+
value: h
|
|
45
|
+
}))
|
|
46
|
+
}]);
|
|
47
|
+
data = choice;
|
|
48
|
+
}
|
|
49
|
+
if (!data)
|
|
50
|
+
return;
|
|
51
|
+
console.clear();
|
|
52
|
+
console.log(chalk_1.default.cyan.bold(`\n Aya Hero: ${data.name}`));
|
|
53
|
+
console.log(chalk_1.default.gray(`Title: ${data.title}\n`));
|
|
54
|
+
console.log(chalk_1.default.white.bold(' Stats:'));
|
|
55
|
+
console.log(`Strength: ${drawBar(data.stats.strength)}`);
|
|
56
|
+
console.log(`Speech: ${drawBar(data.stats.speech)}`);
|
|
57
|
+
console.log(`Patience: ${drawBar(data.stats.patience)}`);
|
|
58
|
+
console.log(`Wisdom: ${drawBar(data.stats.wisdom)}`);
|
|
59
|
+
console.log(chalk_1.default.gray('----------------------------------------'));
|
|
60
|
+
console.log(chalk_1.default.yellow.bold('\n Special Ability:'));
|
|
61
|
+
console.log(chalk_1.default.white(data.specialAbility));
|
|
62
|
+
console.log(chalk_1.default.red.bold('\n Weakness / Challenge:'));
|
|
63
|
+
console.log(chalk_1.default.white(data.weakness));
|
|
64
|
+
console.log(chalk_1.default.magenta.bold('\n Arch-Nemesis:'));
|
|
65
|
+
console.log(chalk_1.default.white(data.archNemesis));
|
|
66
|
+
console.log(chalk_1.default.blue.bold('\n Quranic Profile:'));
|
|
67
|
+
console.log(chalk_1.default.italic(data.quranicProfile));
|
|
68
|
+
console.log('');
|
|
69
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
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.hijriCommand = 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 date_fns_1 = require("date-fns");
|
|
12
|
+
const printer_1 = require("../utils/printer");
|
|
13
|
+
exports.hijriCommand = new commander_1.Command('hijri')
|
|
14
|
+
.description('Date Converter (Gregorian <-> Hijri)')
|
|
15
|
+
.option('-d, --date <date>', 'Date to convert (DD-MM-YYYY)')
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
(0, printer_1.printCommandHeader)('hijri');
|
|
18
|
+
const spinner = (0, ora_1.default)('Converting date...').start();
|
|
19
|
+
try {
|
|
20
|
+
const today = new Date();
|
|
21
|
+
const dateStr = options.date || (0, date_fns_1.format)(today, 'dd-MM-yyyy');
|
|
22
|
+
// Use Aladhan API for accurate conversion based on sighting adjustment if needed
|
|
23
|
+
const response = await axios_1.default.get(`http://api.aladhan.com/v1/gToH/${dateStr}`);
|
|
24
|
+
const data = response.data.data;
|
|
25
|
+
const hijri = data.hijri;
|
|
26
|
+
const gregorian = data.gregorian;
|
|
27
|
+
spinner.stop();
|
|
28
|
+
console.clear();
|
|
29
|
+
console.log(chalk_1.default.green.bold('\n Islamic Date Converter'));
|
|
30
|
+
console.log(chalk_1.default.gray('----------------------------------------'));
|
|
31
|
+
console.log(chalk_1.default.white('Gregorian: ') + chalk_1.default.bold(`${gregorian.day} ${gregorian.month.en} ${gregorian.year}`));
|
|
32
|
+
console.log(chalk_1.default.yellow('Hijri: ') + chalk_1.default.bold(`${hijri.day} ${hijri.month.en} ${hijri.year}`));
|
|
33
|
+
console.log(chalk_1.default.gray(`(${hijri.month.ar})`));
|
|
34
|
+
console.log('');
|
|
35
|
+
console.log(chalk_1.default.cyan(`Weekday: ${hijri.weekday.en} (${hijri.weekday.ar})`));
|
|
36
|
+
console.log('');
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
spinner.fail('Conversion failed.');
|
|
40
|
+
console.log(chalk_1.default.red('Please ensure date format is DD-MM-YYYY'));
|
|
41
|
+
}
|
|
42
|
+
});
|