crisis-to-calm 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 SofiaOrj
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,90 @@
1
+ # 🌿 Crisis to Calm
2
+
3
+ A mindful breathing tool for your terminal. Designed to help developers reset, refocus, and track their mental well-being during long coding sessions.
4
+
5
+ ## Features
6
+ - **Square Breathing:** Follow the 4-step box breathing method (Inhale, Hold, Exhale, Hold).
7
+ - **Themes:** Multiple visual modes like `--ocean`, `--forest`, `--space`, and more!
8
+ - **Gamification:** Earn "Breaths," track your daily streak, and level up from **Baby Breather** to **Zen Legend**.
9
+ - **Deep Focus:** A distraction-free mode that hides the cursor and uses system beeps to bring you back to the presentation.
10
+ - **Wellness Check:** A post-session check-in to provide mental health resources if you're feeling stressed.
11
+
12
+ ## Installation
13
+
14
+ ### Using NPM (Recommended)
15
+ - Prerequisite: Node.js
16
+ ```bash
17
+ npm install -g crisis-to-calm
18
+ ```
19
+
20
+ ### From source
21
+ - Close the repository
22
+ - Enter directory
23
+ ```bash
24
+ cd crisis-to-calm
25
+ ```
26
+ - Install dependencies
27
+ ```bash
28
+ npm install
29
+ ```
30
+ - Link command
31
+ ```bash
32
+ npm link
33
+ ```
34
+
35
+ ### Using .exe file
36
+ - Navigate to releases and download calm.exe
37
+ - To run the default version, open calm.exe
38
+ - To run with flags:
39
+ - Navigate to the folder where calm.exe is located
40
+ - Type `.\calm.exe` and add any flags (ex. `--forest --6 --deep`)
41
+ - Run
42
+
43
+ ## Usage
44
+
45
+ Simply type `calm` to start a standard session, or use flags to customize your experience:
46
+
47
+ ### Configuration Flags
48
+
49
+ | Flag | Description |
50
+ | --- | --- |
51
+ | `--[number]` | Set breath length in seconds (e.g., `--6`, `--10`). Default is 4. |
52
+ | `--deep` | Enter Deep Focus mode (hides cursor, system beeps). |
53
+ | `--random` | Picks a random theme for your session. |
54
+ | `--stats` | View your Rank, Streak, and total breaths taken. |
55
+ | `--help` | Display the manual. |
56
+ | `--reset` | Delete all progress and start fresh. |
57
+
58
+ ### Visual Themes
59
+
60
+ Choose a theme that matches your current vibe:
61
+
62
+ * `--forest` ♣
63
+ * `--ocean` ~
64
+ * `--mountain` ▲
65
+ * `--space` *
66
+ * `--happy` Ü
67
+ * `--surprised` ö
68
+ * `--rainbow` • (Animated!)
69
+
70
+ ---
71
+
72
+ ## Ranks & Progression
73
+
74
+ Your progress is saved locally in your home directory (`~/.crisis-to-calm-stats.json`). Take breaths to unlock new titles:
75
+
76
+ * **Baby Breather** (0 breaths)
77
+ * **Novice Breather** (50 breaths)
78
+ * **Calm Novice** (100 breaths)
79
+ * **Calm Apprentice** (250 breaths)
80
+ * **Steady Hand** (500 breaths)
81
+ * **Breath Royalty** (1,000 breaths)
82
+ * **Breath Master** (2,500 breaths)
83
+ * **Calm Sage** (5,000 breaths)
84
+ * **Zen Legend** (10,000 breaths)
85
+
86
+ ## License
87
+
88
+ This project is licensed under the MIT License - see the [LICENSE](https://www.google.com/search?q=LICENSE) file for details.
89
+
90
+ ```
package/index.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath } from 'url';
8
8
 
9
9
  const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
10
10
  const __dirname = path.resolve();
11
- const statsFilePath = path.join(os.homedir(), '.crisis-to-calm-stats.json');
11
+ const statsFilePath = path.join(__dirname, 'stats.json');
12
12
 
13
13
  const themes = {
14
14
  '--forest': { baseHex: '#00FF00', symbol: '♣ ', bg: chalk.hex('#004400') },
@@ -45,23 +45,38 @@ function updateStats(cyclesCompleted) {
45
45
 
46
46
  try {
47
47
  if (fs.existsSync(statsFilePath)) {
48
- const fileData = fs.readFileSync(statsFilePath, 'utf8');
49
- if (fileData.trim()) stats = JSON.parse(fileData);
48
+ stats = JSON.parse(fs.readFileSync(statsFilePath, 'utf8'));
50
49
  }
51
50
 
52
51
  const oldRank = stats.rank;
53
- const today = new Date().toLocaleDateString();
52
+ const today = new Date().toISOString().split('T')[0];
54
53
  const breathsEarned = cyclesCompleted * 4;
55
54
 
56
55
  // Update totals and streak
57
56
  if (breathsEarned > 0) {
57
+ // If it's the first time ever
58
58
  if (!stats.lastDate) {
59
59
  stats.streak = 1;
60
- } else if (stats.lastDate !== today) {
61
- const yesterday = new Date();
62
- yesterday.setDate(yesterday.getDate() - 1);
63
- stats.streak = (stats.lastDate === yesterday.toLocaleDateString()) ? stats.streak + 1 : 1;
60
+ }
61
+ // If they already breathed today, don't change the streak
62
+ else if (stats.lastDate === today) {
63
+ // Streak stays the same
64
+ }
65
+ // If it's a new day, check if it was yesterday
66
+ else {
67
+ const d = new Date();
68
+ d.setDate(d.getDate() - 1);
69
+ const yesterday = d.toISOString().split('T')[0];
70
+
71
+ if (stats.lastDate === yesterday) {
72
+ stats.streak += 1;
73
+ console.log("Streak continued! New streak:", stats.streak);
74
+ } else {
75
+ stats.streak = 1;
76
+ console.log("Streak reset to 1 (missed a day).");
77
+ }
64
78
  }
79
+ stats.lastDate = today; // Mark today as the last breathing day
65
80
  }
66
81
 
67
82
  stats.totalBreaths += breathsEarned;
@@ -305,8 +320,8 @@ function displayHelp() {
305
320
  }
306
321
 
307
322
  async function startBreathing() {
308
- const args = process.argv; // Get all command-line arguments
309
- if (args.includes('--help') || args.includes('-h')) {
323
+ const args = process.argv; // Get all command line arguments
324
+ if (args.includes('--help') || args.includes('--h')) {
310
325
  displayHelp();
311
326
  process.exit();
312
327
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crisis-to-calm",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/calm.exe DELETED
Binary file
package/calm.zip DELETED
Binary file
package/stats.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "totalBreaths": 48,
3
- "streak": 1,
4
- "lastDate": "12/22/2025",
5
- "rank": "Baby Breather",
6
- "icon": "🍼"
7
- }