gitsawe 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BereketeAb
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,64 @@
1
+ # gitsawe
2
+
3
+ Open JSON data for Gitsawe readings, feasts, sub-feasts, months, mahlets, and packages.
4
+
5
+ ## Data files
6
+
7
+ - `data/daily-gitsawe.json`
8
+ - `data/seasonal-gitsawe.json`
9
+ - `data/monthly-gitsawe.json`
10
+ - `data/months.json`
11
+ - `data/feasts.json`
12
+ - `data/sub-feasts.json`
13
+ - `data/mahlets.json`
14
+ - `data/packages.json`
15
+
16
+ ## Package API
17
+
18
+ ```ts
19
+ import { Gitsawe, gitsaweData, dailyGitsawe, seasonalGitsawe, monthlyGitsawe } from "gitsawe";
20
+ ```
21
+
22
+ `gitsaweData` preserves the original seed order from GitsaweBot:
23
+ daily, seasonal fast/feast data, then monthly data.
24
+
25
+ ### Find readings
26
+
27
+ ```ts
28
+ const newYear = Gitsawe.find({
29
+ type: "daily",
30
+ date: new Date(2025, 8, 11),
31
+ });
32
+
33
+ const byKey = Gitsawe.find({
34
+ type: "daily",
35
+ date: "01-01",
36
+ });
37
+ ```
38
+
39
+ `Date` values are read as local Gregorian dates and converted to the
40
+ Ethiopian `DD-MM` key used by the daily Gitsawe data. String dates are matched
41
+ exactly as provided.
42
+
43
+ ## Validate
44
+
45
+ ```sh
46
+ npm test
47
+ ```
48
+
49
+ ## CLI
50
+
51
+ ```sh
52
+ npx gitsawe daily 01-01
53
+ ```
54
+
55
+ The CLI prints JSON. Use `daily`, `seasonal`, `monthly`, or `all`; omit the
56
+ date to print the full selected collection.
57
+
58
+ ## Source
59
+
60
+ Generated from the GitsaweBot seed files with:
61
+
62
+ ```sh
63
+ npm run export:data
64
+ ```
package/bin/gitsawe.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { readFileSync } = require("node:fs");
4
+ const { join } = require("node:path");
5
+
6
+ const collections = {
7
+ daily: "daily-gitsawe.json",
8
+ seasonal: "seasonal-gitsawe.json",
9
+ monthly: "monthly-gitsawe.json",
10
+ all: null,
11
+ };
12
+
13
+ function readJson(fileName) {
14
+ return JSON.parse(readFileSync(join(__dirname, "..", "data", fileName), "utf8"));
15
+ }
16
+
17
+ function readCollection(type) {
18
+ if (type === "all") {
19
+ return [
20
+ ...readJson(collections.daily),
21
+ ...readJson(collections.seasonal),
22
+ ...readJson(collections.monthly),
23
+ ];
24
+ }
25
+
26
+ return readJson(collections[type]);
27
+ }
28
+
29
+ function printUsage() {
30
+ console.log(`Usage: gitsawe [type] [date]
31
+
32
+ Types:
33
+ daily Daily Gitsawe readings
34
+ seasonal Seasonal fast and feast readings
35
+ monthly Monthly readings
36
+ all All Gitsawe readings
37
+
38
+ Examples:
39
+ gitsawe
40
+ gitsawe daily
41
+ gitsawe daily 01-01`);
42
+ }
43
+
44
+ const args = process.argv.slice(2);
45
+
46
+ if (args.includes("--help") || args.includes("-h")) {
47
+ printUsage();
48
+ process.exit(0);
49
+ }
50
+
51
+ const type = args[0] || "all";
52
+ const date = args[1];
53
+
54
+ if (!Object.hasOwn(collections, type)) {
55
+ console.error(`Unknown Gitsawe type: ${type}`);
56
+ printUsage();
57
+ process.exit(1);
58
+ }
59
+
60
+ const entries = readCollection(type);
61
+ const result = date === undefined ? entries : entries.filter((entry) => entry.date === date);
62
+
63
+ console.log(JSON.stringify(result, null, 2));