breathe-terminal 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/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # breathe-cli
2
+
3
+ Military-grade breathing techniques in your terminal.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g breathe-cli
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ # Interactive mode
15
+ breathe
16
+
17
+ # Or use npx (no install needed)
18
+ npx breathe-cli
19
+
20
+ # Specific techniques
21
+ breathe box # Box Breathing
22
+ breathe relax # 4-7-8 Relaxation
23
+ breathe tactical # Tactical Recovery
24
+ breathe wim # Wim Hof Method
25
+ breathe resonance # Resonance Breathing
26
+ breathe sigh # Physiological Sigh
27
+ ```
28
+
29
+ ## Alternative Installation
30
+
31
+ If the npm package doesn't work for your platform, install via Cargo:
32
+
33
+ ```bash
34
+ cargo install breathe
35
+ ```
36
+
37
+ ## License
38
+
39
+ MIT
package/bin/breathe ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ const isWindows = process.platform === 'win32';
8
+ const binaryName = isWindows ? 'breathe.exe' : 'breathe';
9
+ const binaryPath = path.join(__dirname, binaryName);
10
+
11
+ if (!fs.existsSync(binaryPath)) {
12
+ console.error('breathe binary not found. Try reinstalling:');
13
+ console.error(' npm uninstall -g breathe-cli && npm install -g breathe-cli');
14
+ console.error('\nOr install from source:');
15
+ console.error(' cargo install breathe');
16
+ process.exit(1);
17
+ }
18
+
19
+ const child = spawn(binaryPath, process.argv.slice(2), {
20
+ stdio: 'inherit',
21
+ windowsHide: false,
22
+ });
23
+
24
+ child.on('close', (code) => {
25
+ process.exit(code);
26
+ });
package/install.js ADDED
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+
3
+ const https = require('https');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const VERSION = '0.1.0';
9
+ const REPO = 'AtomicIntuition/breathe-cli';
10
+
11
+ function getPlatformInfo() {
12
+ const platform = process.platform;
13
+ const arch = process.arch;
14
+
15
+ const platformMap = {
16
+ 'darwin-x64': 'breathe-darwin-x64',
17
+ 'darwin-arm64': 'breathe-darwin-arm64',
18
+ 'linux-x64': 'breathe-linux-x64',
19
+ 'win32-x64': 'breathe-windows-x64.exe',
20
+ };
21
+
22
+ const key = `${platform}-${arch}`;
23
+ const binaryName = platformMap[key];
24
+
25
+ if (!binaryName) {
26
+ console.error(`Unsupported platform: ${platform}-${arch}`);
27
+ console.error('Supported platforms: darwin-x64, darwin-arm64, linux-x64, win32-x64');
28
+ console.error('\nYou can install from source with: cargo install breathe');
29
+ process.exit(1);
30
+ }
31
+
32
+ return {
33
+ binaryName,
34
+ isWindows: platform === 'win32',
35
+ };
36
+ }
37
+
38
+ function downloadFile(url, dest) {
39
+ return new Promise((resolve, reject) => {
40
+ const file = fs.createWriteStream(dest);
41
+ https.get(url, (response) => {
42
+ if (response.statusCode === 302 || response.statusCode === 301) {
43
+ file.close();
44
+ fs.unlinkSync(dest);
45
+ downloadFile(response.headers.location, dest).then(resolve).catch(reject);
46
+ return;
47
+ }
48
+
49
+ if (response.statusCode !== 200) {
50
+ file.close();
51
+ fs.unlinkSync(dest);
52
+ reject(new Error(`Failed to download: ${response.statusCode}`));
53
+ return;
54
+ }
55
+
56
+ response.pipe(file);
57
+ file.on('finish', () => {
58
+ file.close();
59
+ resolve();
60
+ });
61
+ }).on('error', (err) => {
62
+ file.close();
63
+ fs.unlinkSync(dest);
64
+ reject(err);
65
+ });
66
+ });
67
+ }
68
+
69
+ async function install() {
70
+ const { binaryName, isWindows } = getPlatformInfo();
71
+ const binDir = path.join(__dirname, 'bin');
72
+ const finalBinaryName = isWindows ? 'breathe.exe' : 'breathe';
73
+ const binaryPath = path.join(binDir, finalBinaryName);
74
+ const extension = isWindows ? '.zip' : '.tar.gz';
75
+
76
+ // Create bin directory
77
+ if (!fs.existsSync(binDir)) {
78
+ fs.mkdirSync(binDir, { recursive: true });
79
+ }
80
+
81
+ const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${binaryName}${extension}`;
82
+ const archivePath = path.join(binDir, `breathe${extension}`);
83
+
84
+ console.log(`Downloading breathe v${VERSION} for ${process.platform}-${process.arch}...`);
85
+
86
+ try {
87
+ await downloadFile(downloadUrl, archivePath);
88
+
89
+ if (isWindows) {
90
+ // Use PowerShell to extract zip on Windows
91
+ execSync(`powershell -command "Expand-Archive -Force '${archivePath}' '${binDir}'"`, { stdio: 'inherit' });
92
+ const extractedFile = path.join(binDir, binaryName);
93
+ if (fs.existsSync(extractedFile)) {
94
+ fs.renameSync(extractedFile, binaryPath);
95
+ }
96
+ } else {
97
+ // Use tar on Unix
98
+ execSync(`tar -xzf "${archivePath}" -C "${binDir}"`, { stdio: 'inherit' });
99
+ const extractedFile = path.join(binDir, binaryName);
100
+ if (fs.existsSync(extractedFile)) {
101
+ fs.renameSync(extractedFile, binaryPath);
102
+ }
103
+ fs.chmodSync(binaryPath, 0o755);
104
+ }
105
+
106
+ // Clean up archive
107
+ fs.unlinkSync(archivePath);
108
+
109
+ console.log('breathe installed successfully!');
110
+ } catch (error) {
111
+ console.error(`\nFailed to install breathe: ${error.message}`);
112
+ console.error('\nThe release binaries may not be available yet.');
113
+ console.error('You can install from source with: cargo install breathe');
114
+ process.exit(1);
115
+ }
116
+ }
117
+
118
+ install();
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "breathe-terminal",
3
+ "version": "0.1.0",
4
+ "description": "Military-grade breathing techniques in your terminal",
5
+ "bin": {
6
+ "breathe": "bin/breathe"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node install.js"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/AtomicIntuition/breathe-cli.git"
14
+ },
15
+ "keywords": [
16
+ "cli",
17
+ "breathing",
18
+ "meditation",
19
+ "wellness",
20
+ "terminal",
21
+ "box-breathing",
22
+ "relaxation"
23
+ ],
24
+ "author": "Atomic Intuition",
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/AtomicIntuition/breathe-cli/issues"
28
+ },
29
+ "homepage": "https://github.com/AtomicIntuition/breathe-cli#readme",
30
+ "engines": {
31
+ "node": ">=14"
32
+ },
33
+ "os": [
34
+ "darwin",
35
+ "linux",
36
+ "win32"
37
+ ],
38
+ "cpu": [
39
+ "x64",
40
+ "arm64"
41
+ ]
42
+ }