@adithya-naik/cmd-tracker 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.
@@ -0,0 +1 @@
1
+ * @adithya-naik
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,26 @@
1
+ ## Summary
2
+
3
+ Describe the changes made in this pull request.
4
+
5
+ ## Related Issue
6
+
7
+ Closes #
8
+
9
+ ## Type of Change
10
+
11
+ - [ ] Bug fix
12
+ - [ ] New feature
13
+ - [ ] Documentation update
14
+ - [ ] Refactoring
15
+ - [ ] CI/CD
16
+
17
+ ## Testing
18
+
19
+ - [ ] Tested locally
20
+ - [ ] Existing functionality still works
21
+
22
+ ## Checklist
23
+
24
+ - [ ] Code follows project conventions
25
+ - [ ] Documentation updated if needed
26
+ - [ ] Linked to an issue
@@ -0,0 +1,77 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - develop
7
+ - main
8
+
9
+ # Least privilege permissions
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ validate:
15
+ name: Validate Code
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
21
+ with:
22
+ persist-credentials: false
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
26
+ with:
27
+ node-version: "20"
28
+ cache: "npm"
29
+
30
+ - name: Install dependencies
31
+ run: npm ci
32
+
33
+ - name: Validate package.json
34
+ run: node -e "require('./package.json')"
35
+
36
+ - name: Validate project structure
37
+ run: |
38
+ echo "Checking required files exist..."
39
+ test -f bin/tracker.js && echo "✅ bin/tracker.js exists"
40
+ test -f src/utils/storage.js && echo "✅ storage.js exists"
41
+ test -f src/utils/categorizer.js && echo "✅ categorizer.js exists"
42
+ test -f src/utils/validator.js && echo "✅ validator.js exists"
43
+ test -f src/utils/hook.js && echo "✅ hook.js exists"
44
+ test -f src/commands/init.js && echo "✅ init.js exists"
45
+ test -f src/commands/save.js && echo "✅ save.js exists"
46
+ test -f src/commands/list.js && echo "✅ list.js exists"
47
+ test -f src/commands/search.js && echo "✅ search.js exists"
48
+ test -f src/commands/stats.js && echo "✅ stats.js exists"
49
+ test -f src/commands/clear.js && echo "✅ clear.js exists"
50
+ test -f src/commands/export.js && echo "✅ export.js exists"
51
+ test -f src/commands/favorite.js && echo "✅ favorite.js exists"
52
+ test -f src/commands/hook.js && echo "✅ hook command exists"
53
+ echo "✅ All required files present!"
54
+
55
+ - name: Test core functionality
56
+ run: |
57
+ echo "Testing categorizer..."
58
+ node -e "
59
+ const {categorize} = require('./src/utils/categorizer');
60
+ function assert(condition, message) {
61
+ if (!condition) throw new Error('FAILED: ' + message);
62
+ }
63
+ assert(categorize('git status') === 'git', 'git failed');
64
+ assert(categorize('npm install') === 'npm', 'npm failed');
65
+ assert(categorize('docker ps') === 'docker', 'docker failed');
66
+ assert(categorize('ls -la') === 'linux', 'linux failed');
67
+ assert(categorize('ng serve') === 'angular', 'angular failed');
68
+ assert(categorize('go run main.go') === 'go', 'go failed');
69
+ assert(categorize('aws s3 ls') === 'cloud', 'cloud failed');
70
+ assert(categorize('jest') === 'testing', 'testing failed');
71
+ console.log('✅ All categorizer tests passed!');
72
+ "
73
+
74
+ - name: Test CLI loads
75
+ run: |
76
+ node bin/tracker.js --version
77
+ echo "✅ CLI loads successfully!"
@@ -0,0 +1,77 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+
11
+ jobs:
12
+ publish:
13
+ name: Bump Version and Publish
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
19
+ with:
20
+ fetch-depth: 0
21
+ token: ${{ secrets.GITHUB_TOKEN }}
22
+ persist-credentials: true
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
26
+ with:
27
+ node-version: "20"
28
+ registry-url: "https://registry.npmjs.org"
29
+ cache: "npm"
30
+
31
+ - name: Install dependencies
32
+ run: npm ci
33
+
34
+ - name: Configure git
35
+ run: |
36
+ git config user.name "github-actions[bot]"
37
+ git config user.email "github-actions[bot]@users.noreply.github.com"
38
+
39
+ - name: Bump patch version
40
+ run: |
41
+ npm version patch --no-git-tag-version
42
+ NEW_VERSION=$(node -e "console.log(require('./package.json').version)")
43
+ git add package.json package-lock.json
44
+ git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
45
+ git tag "v$NEW_VERSION"
46
+
47
+ - name: Push version bump
48
+ run: git push origin main --follow-tags
49
+
50
+ - name: Get new version
51
+ id: get_version
52
+ run: |
53
+ NEW_VERSION=$(node -e "console.log(require('./package.json').version)")
54
+ echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
55
+
56
+ - name: Create GitHub Release
57
+ uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631
58
+ with:
59
+ tag_name: v${{ steps.get_version.outputs.version }}
60
+ name: v${{ steps.get_version.outputs.version }}
61
+ body: |
62
+ ## v${{ steps.get_version.outputs.version }}
63
+
64
+ ### Installation
65
+ npm install @adithya-naik/cmd-tracker
66
+
67
+ ### Quick Start
68
+ npx tracker init
69
+ npx tracker hook
70
+ source ~/.bashrc
71
+ env:
72
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73
+
74
+ - name: Publish to npm
75
+ run: npm publish --access public
76
+ env:
77
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ jatothadithyanaik@gmail.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
package/README.md CHANGED
@@ -5,6 +5,10 @@
5
5
  ### A developer tool that auto-captures, categorizes and saves terminal commands per project for easy revision
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@adithya-naik/cmd-tracker.svg)](https://www.npmjs.com/package/@adithya-naik/cmd-tracker)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@adithya-naik/cmd-tracker.svg)](https://www.npmjs.com/package/@adithya-naik/cmd-tracker)
9
+ [![npm total downloads](https://img.shields.io/npm/dt/@adithya-naik/cmd-tracker.svg)](https://www.npmjs.com/package/@adithya-naik/cmd-tracker)
10
+ [![GitHub stars](https://img.shields.io/github/stars/adithya-naik/cmd-tracker.svg)](https://github.com/adithya-naik/cmd-tracker/stargazers)
11
+ [![GitHub issues](https://img.shields.io/github/issues/adithya-naik/cmd-tracker.svg)](https://github.com/adithya-naik/cmd-tracker/issues)
8
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
13
  [![Node.js](https://img.shields.io/badge/Node.js-v14%2B-green.svg)](https://nodejs.org)
10
14
 
@@ -55,7 +59,9 @@ npx tracker init
55
59
  **Step 2 — Enable automatic capture:**
56
60
  ```bash
57
61
  npx tracker hook
58
- source ~/.bashrc # or source ~/.zshrc on Mac
62
+ source ~/.bashrc # bash
63
+ source ~/.zshrc # zsh (Mac)
64
+ source ~/.config/fish/config.fish # fish
59
65
  ```
60
66
 
61
67
  **Step 3 — Work normally! Then revise:**
@@ -100,6 +106,16 @@ Commands are automatically categorized into:
100
106
  | 🟢 `node` | node, nodemon... |
101
107
  | 🔴 `angular` | ng new, ng serve, ng generate... |
102
108
  | 🐍 `python` | python, pip install... |
109
+ | 🔷 `go` | go build, go run, go get... |
110
+ | ☕ `java` | java, javac, mvn, gradle... |
111
+ | 🦀 `rust` | cargo build, cargo run, rustc... |
112
+ | 🔷 `dotnet` | dotnet run, dotnet build... |
113
+ | ☸️ `kubernetes` | kubectl get pods, helm install... |
114
+ | 🗄️ `database` | mysql, psql, mongosh, redis-cli... |
115
+ | ☁️ `cloud` | aws s3 ls, gcloud, az login... |
116
+ | 📥 `packageManagers` | yarn, pnpm, brew, snap... |
117
+ | 🧪 `testing` | jest, vitest, playwright, cypress... |
118
+ | 🤖 `ai` | claude, gemini, opencode, aider... |
103
119
  | 📌 `others` | everything else |
104
120
 
105
121
  ---
@@ -158,12 +174,49 @@ your-project/
158
174
  | Linux (bash) | ✅ Full support |
159
175
  | Windows (Git Bash) | ✅ Supported |
160
176
  | Windows (PowerShell) | ⚠️ Manual save only |
177
+ | Fish | ✅ Full support |
161
178
 
162
179
  > Windows CMD/PowerShell users: use `tracker save "command"` manually
163
180
  > or use Git Bash / WSL for automatic capture
164
181
 
165
182
  ---
166
183
 
184
+ ## 🐟 Fish Shell Support
185
+
186
+ ### Install Fish Shell
187
+
188
+ **Mac:**
189
+ ```bash
190
+ brew install fish
191
+ ```
192
+
193
+ **Ubuntu/Debian:**
194
+ ```bash
195
+ sudo apt install fish
196
+ ```
197
+
198
+ **Fedora:**
199
+ ```bash
200
+ sudo dnf install fish
201
+ ```
202
+
203
+ **Windows (WSL):**
204
+ ```bash
205
+ sudo apt install fish
206
+ ```
207
+
208
+ ### Setup tracker in Fish
209
+
210
+ ```bash
211
+ npx tracker init
212
+ npx tracker hook
213
+ source ~/.config/fish/config.fish
214
+ ```
215
+
216
+ That's it! Every command you type in fish will now be saved automatically! 🎉
217
+
218
+ ---
219
+
167
220
  ## 🤝 Contributing
168
221
 
169
222
  Contributions are welcome! Feel free to:
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@adithya-naik/cmd-tracker",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "📟 A developer tool that auto-captures, categorizes and saves terminal commands per project for easy revision",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
- "tracker": "bin/tracker.js"
7
+ "tracker": "./bin/tracker.js"
8
8
  },
9
9
  "scripts": {
10
10
  "test": "echo \"No tests yet\""
@@ -61,7 +61,11 @@ function hookCommand() {
61
61
  * Even on Windows — Git Bash uses Unix paths
62
62
  * ~/.bashrc works on all systems
63
63
  */
64
- const sourceCmd = result.shell === "zsh" ? "~/.zshrc" : "~/.bashrc";
64
+ const sourceCmd = {
65
+ zsh: "~/.zshrc",
66
+ bash: "~/.bashrc",
67
+ fish: "~/.config/fish/config.fish",
68
+ }[result.shell];
65
69
  console.log(`\n source ${sourceCmd}\n`);
66
70
  console.log("After that — every command you type will be saved automatically! 🚀\n");
67
71
  }
@@ -78,12 +82,17 @@ function unhookCommand() {
78
82
  const result = removeHook();
79
83
  console.log(result.message);
80
84
 
81
- if (result.success) {
82
- console.log("\n🎯 Almost done! Run this to apply changes:");
83
- const sourceCmd = result.shell === "zsh" ? "~/.zshrc" : "~/.bashrc";
84
- console.log(`\n source ${sourceCmd}\n`);
85
- console.log("After that — automatic capture will be disabled\n");
86
- }
85
+ if (result.success) {
86
+ console.log("\n🎯 Almost done! Run this to apply changes:");
87
+ const shell = result.shell || detectShell();
88
+ const sourceCmd = {
89
+ zsh: "~/.zshrc",
90
+ bash: "~/.bashrc",
91
+ fish: "~/.config/fish/config.fish",
92
+ }[shell];
93
+ console.log(`\n source ${sourceCmd}\n`);
94
+ console.log("After that — automatic capture will be disabled\n");
95
+ }
87
96
  }
88
97
 
89
- module.exports = { hookCommand, unhookCommand };
98
+ module.exports = { hookCommand, unhookCommand };
@@ -85,7 +85,17 @@ function displayCategory(categoryName, commands) {
85
85
  node: "🟢",
86
86
  angular: "🔴",
87
87
  python: "🐍",
88
- others: "📌"
88
+ go: "🔷",
89
+ java: "☕",
90
+ rust: "🦀",
91
+ dotnet: "🔷",
92
+ kubernetes: "☸️",
93
+ database: "🗄️",
94
+ cloud: "☁️",
95
+ packagemanagers: "📥",
96
+ testing: "🧪",
97
+ ai: "🤖",
98
+ others: "📌"
89
99
  };
90
100
 
91
101
  const icon = icons[categoryName] || "📌";
@@ -104,4 +114,4 @@ function displayCategory(categoryName, commands) {
104
114
  });
105
115
  }
106
116
 
107
- module.exports = { listCommand };
117
+ module.exports = { listCommand };
@@ -57,7 +57,17 @@ function statsCommand() {
57
57
  node: "🟢",
58
58
  angular: "🔴",
59
59
  python: "🐍",
60
- others: "📌"
60
+ go: "🔷",
61
+ java: "☕",
62
+ rust: "🦀",
63
+ dotnet: "🔷",
64
+ kubernetes: "☸️",
65
+ database: "🗄️",
66
+ cloud: "☁️",
67
+ packageManagers: "📥",
68
+ testing: "🧪",
69
+ ai: "🤖",
70
+ others: "📌"
61
71
  };
62
72
 
63
73
  /*
@@ -1,19 +1,20 @@
1
1
  /*
2
2
  * categorizer.js
3
- *
3
+ *
4
4
  * This file has ONE job — look at a command and decide its category
5
5
  * Example:
6
6
  * "git status" → "git"
7
7
  * "npm install" → "npm"
8
8
  * "docker ps" → "docker"
9
9
  * "ls -la" → "linux"
10
+ * "go get <pkgURL>" → "go"
10
11
  * "ng new my-app" → "others"
11
12
  */
12
13
 
13
14
  /*
14
15
  * We define all our categories and their keywords here
15
16
  * This is called a CONFIGURATION OBJECT
16
- *
17
+ *
17
18
  * Why keep it here separately?
18
19
  * → Easy to add new categories later
19
20
  * → Easy to add new keywords to existing categories
@@ -43,28 +44,17 @@ const CATEGORIES = {
43
44
  * Common linux commands go here
44
45
  * Examples: ls -la, cd projects, mkdir new-folder
45
46
  */
46
- linux: [
47
- "ls",
48
- "cd",
49
- "pwd",
50
- "mkdir",
51
- "rm",
52
- "cp",
53
- "mv",
54
- "cat",
55
- "touch",
56
- "chmod",
57
- "chown",
58
- "grep",
59
- "find",
60
- "echo",
61
- "sudo",
62
- "apt",
63
- "curl",
64
- "wget",
65
- "nano",
66
- "vim"
67
- ],
47
+ linux: [
48
+ "ls", "cd", "pwd", "mkdir", "rmdir",
49
+ "rm", "cp", "mv", "cat", "touch",
50
+ "chmod", "chown", "grep", "find",
51
+ "echo", "sudo", "apt", "apt-get",
52
+ "curl", "wget", "nano", "vim",
53
+ "less", "head", "tail", "ps",
54
+ "top", "kill", "df", "du",
55
+ "tar", "zip", "unzip", "ssh",
56
+ "scp", "rsync"
57
+ ],
68
58
 
69
59
  /*
70
60
  * Node.js related commands
@@ -83,17 +73,122 @@ const CATEGORIES = {
83
73
  * Examples: python app.py, pip install flask
84
74
  */
85
75
  python: ["python", "python3", "pip", "pip3"],
76
+
77
+ go: ["go"],
78
+
79
+ /*
80
+ * Java ecosystem commands
81
+ * Examples: java Main, javac Main.java,
82
+ * mvn package, gradle build
83
+ */
84
+ java: ["java", "javac", "mvn", "gradle"],
85
+
86
+ /*
87
+ * Rust development commands
88
+ * Examples: cargo build, cargo run,
89
+ * cargo test, rustc main.rs
90
+ */
91
+ rust: ["cargo", "rustc"],
92
+
93
+ /*
94
+ * .NET commands
95
+ * Examples: dotnet run, dotnet build,
96
+ * dotnet new console
97
+ */
98
+ dotnet: ["dotnet"],
99
+
100
+ /*
101
+ * Kubernetes tooling commands
102
+ * Examples: kubectl get pods,
103
+ * kubectl apply -f app.yaml,
104
+ * helm install my-app chart/
105
+ */
106
+ kubernetes: ["kubectl", "helm"],
107
+
108
+ /*
109
+ * Database CLI commands
110
+ * Examples: mysql -u root -p,
111
+ * psql mydb,
112
+ * mongosh,
113
+ * redis-cli
114
+ */
115
+ database: [
116
+ "mysql",
117
+ "psql",
118
+ "sqlite3",
119
+ "mongosh",
120
+ "redis-cli"
121
+ ],
122
+
123
+ /*
124
+ * Cloud provider CLI commands
125
+ * Examples: aws s3 ls,
126
+ * gcloud compute instances list,
127
+ * az login
128
+ */
129
+ cloud: [
130
+ "aws",
131
+ "gcloud",
132
+ "az"
133
+ ],
134
+
135
+ /*
136
+ * Package manager commands
137
+ * Examples: yarn install,
138
+ * pnpm dev,
139
+ * brew install git,
140
+ * snap install code
141
+ */
142
+ packagemanagers: [
143
+ "yarn",
144
+ "pnpm",
145
+ "brew",
146
+ "snap"
147
+ ],
148
+
149
+ /*
150
+ * Testing framework commands
151
+ * Examples: jest,
152
+ * vitest run,
153
+ * playwright test,
154
+ * cypress open
155
+ */
156
+ testing: [
157
+ "jest",
158
+ "vitest",
159
+ "playwright",
160
+ "cypress"
161
+ ],
162
+
163
+ /*
164
+ * AI coding assistant CLI commands
165
+ * Examples: claude, gemini, codex,
166
+ * opencode, aider, q chat
167
+ */
168
+ ai: [
169
+ "claude",
170
+ "gemini",
171
+ "codex",
172
+ "c",
173
+ "opencode",
174
+ "aider",
175
+ "q",
176
+ "warp",
177
+ "ollama",
178
+ "huggingface-cli"
179
+ ],
180
+
86
181
  };
87
182
 
88
183
  /*
89
184
  * categorize() — the main function of this file
90
- *
185
+ *
91
186
  * It takes a command string as input
92
187
  * It returns the category name as a string
93
- *
188
+ *
94
189
  * @param {string} command - the terminal command typed by user
95
190
  * @returns {string} - category name (git/npm/docker/linux/node/angular/python/others)
96
- *
191
+ *
97
192
  * Example:
98
193
  * categorize("git status") → "git"
99
194
  * categorize("npm install") → "npm"
@@ -114,7 +209,7 @@ function categorize(command) {
114
209
  * .trim() → removes spaces from start and end
115
210
  * .toLowerCase() → converts to lowercase so "Git Status" = "git status"
116
211
  * .split(" ")[0] → takes only the FIRST word
117
- *
212
+ *
118
213
  * Example:
119
214
  * " git status " → trim → "git status"
120
215
  * → toLowerCase → "git status"
@@ -130,14 +225,14 @@ function categorize(command) {
130
225
  * ["npm", ["npm", "npx"]],
131
226
  * ...
132
227
  * ]
133
- *
228
+ *
134
229
  * We loop through each [categoryName, keywords] pair
135
230
  */
136
231
  for (const [categoryName, keywords] of Object.entries(CATEGORIES)) {
137
232
 
138
233
  /*
139
234
  * .includes() checks if our firstWord exists in the keywords array
140
- *
235
+ *
141
236
  * Example:
142
237
  * categoryName = "npm"
143
238
  * keywords = ["npm", "npx"]
@@ -159,7 +254,7 @@ function categorize(command) {
159
254
  /*
160
255
  * module.exports → makes this function available to other files
161
256
  * Without this line — no other file can use categorize()
162
- *
257
+ *
163
258
  * This is how Node.js shares code between files
164
259
  */
165
- module.exports = { categorize };
260
+ module.exports = { categorize };
package/src/utils/hook.js CHANGED
@@ -8,18 +8,18 @@
8
8
  * Supported shells:
9
9
  * → bash → hooks into ~/.bashrc
10
10
  * → zsh → hooks into ~/.zshrc
11
- * → Both are most common shells on Mac/Linux
11
+ * → fish hooks into ~/.config/fish/config.fish
12
12
  *
13
13
  * How it works:
14
- * 1. Detect user's shell (bash or zsh)
14
+ * 1. Detect user's shell (bash, zsh, or fish)
15
15
  * 2. Add a hook script to their shell config file
16
16
  * 3. Hook script calls "tracker save <command>" after every command
17
17
  * 4. User sources their config → automatic capture starts!
18
18
  */
19
19
 
20
- const fs = require("fs");
21
- const path = require("path");
22
- const os = require("os");
20
+ const fs = require("node:fs");
21
+ const path = require("node:path");
22
+ const os = require("node:os");
23
23
 
24
24
  /*
25
25
  * os module — built into Node.js
@@ -35,7 +35,9 @@ const HOME_DIR = os.homedir();
35
35
  */
36
36
  const SHELL_CONFIGS = {
37
37
  bash: path.join(HOME_DIR, ".bashrc"),
38
- zsh: path.join(HOME_DIR, ".zshrc")
38
+ zsh: path.join(HOME_DIR, ".zshrc"),
39
+ fish: path.join(HOME_DIR, ".config/fish/config.fish"),
40
+
39
41
  };
40
42
 
41
43
  /*
@@ -90,6 +92,21 @@ const HOOK_SCRIPT = [
90
92
  ""
91
93
  ].join("\n");
92
94
 
95
+
96
+ const FISH_HOOK_SCRIPT = [
97
+ "",
98
+ "# cmd-tracker shell hook — auto saves every command you type",
99
+ "function __cmd_tracker_postexec --on-event fish_postexec",
100
+ " set -l last_cmd (history --max=1)",
101
+ "",
102
+ ' if test -n "$last_cmd"',
103
+ ' tracker save "$last_cmd" >/dev/null 2>&1',
104
+ " end",
105
+ "end",
106
+ "",
107
+ ].join("\n");
108
+
109
+
93
110
  /*
94
111
  * HOOK_MARKER — unique string we add to identify our hook
95
112
  * We use this to:
@@ -101,27 +118,38 @@ const HOOK_MARKER = "# cmd-tracker shell hook — auto saves every command you t
101
118
  /*
102
119
  * detectShell() — detects which shell user is running
103
120
  *
104
- * process.env.SHELL → environment variable containing shell path
105
- * Example:
106
- * "/bin/bash" bash
107
- * "/bin/zsh" → zsh
121
+ * Priority:
122
+ * 1. process.env.FISH_VERSION — fish sets this automatically
123
+ * even when launched from another shell (parent $SHELL
124
+ * would still show bash/zsh)
125
+ * 2. process.env.SHELL — the standard shell path variable
126
+ * Examples: "/bin/bash" → bash, "/bin/zsh" → zsh
108
127
  *
109
- * @returns {string} — "bash", "zsh", or "unknown"
128
+ * @returns {string} — "bash", "zsh", "fish", or "unknown"
110
129
  */
111
130
  function detectShell() {
112
- const shell = process.env.SHELL || "";
131
+ const shell = process.env.SHELL || "";
132
+
133
+ if (process.env.FISH_VERSION) return "fish";
113
134
 
114
- if (shell.includes("zsh")) return "zsh";
115
- if (shell.includes("bash")) return "bash";
135
+ if (shell.includes("fish")) return "fish";
116
136
 
117
- /*
118
- * On Windows — check SHELL or ComSpec
119
- * Most Windows users use bash via Git Bash
120
- */
121
- const comspec = process.env.ComSpec || "";
122
- if (comspec.includes("cmd.exe")) return "unknown";
137
+ try {
138
+ const ppid = process.ppid;
139
+ const { execFileSync } = require("node:child_process");
140
+ const comm = execFileSync("/bin/ps", ["-o", "comm=", "-p", String(ppid)], { encoding: "utf-8" }).trim();
141
+ if (comm.includes("fish")) return "fish";
142
+ if (comm.includes("zsh")) return "zsh";
143
+ if (comm.includes("bash")) return "bash";
144
+ } catch (_) {}
123
145
 
124
- return "bash"; // default to bash
146
+ if (shell.includes("zsh")) return "zsh";
147
+ if (shell.includes("bash")) return "bash";
148
+
149
+ const comspec = process.env.ComSpec || "";
150
+ if (comspec.includes("cmd.exe")) return "unknown";
151
+
152
+ return "unknown";
125
153
  }
126
154
 
127
155
  /*
@@ -176,7 +204,17 @@ function installHook() {
176
204
  * Append hook script to shell config file
177
205
  * appendFileSync → adds to end without deleting existing content
178
206
  */
179
- fs.appendFileSync(configFile, HOOK_SCRIPT);
207
+ if (shell === "fish") {
208
+ fs.mkdirSync(path.dirname(configFile), { recursive: true });
209
+ }
210
+
211
+ /*
212
+ * Choose correct hook
213
+ */
214
+ const hookScript =
215
+ shell === "fish" ? FISH_HOOK_SCRIPT : HOOK_SCRIPT;
216
+
217
+ fs.appendFileSync(configFile, hookScript);
180
218
 
181
219
  return {
182
220
  success: true,
@@ -278,4 +316,4 @@ module.exports = {
278
316
  removeHook,
279
317
  isHookInstalled,
280
318
  detectShell
281
- };
319
+ };
@@ -56,6 +56,16 @@ function getDefaultStructure() {
56
56
  node: [],
57
57
  angular: [],
58
58
  python: [],
59
+ go: [],
60
+ java: [],
61
+ rust: [],
62
+ dotnet: [],
63
+ kubernetes: [],
64
+ database: [],
65
+ cloud: [],
66
+ packagemanagers: [],
67
+ testing: [],
68
+ ai: [],
59
69
  others: [],
60
70
  };
61
71
  }
@@ -123,7 +133,8 @@ function readCommands() {
123
133
  * JSON.parse() → converts JSON text back to JavaScript object
124
134
  */
125
135
  const fileContent = fs.readFileSync(COMMANDS_FILE, "utf-8");
126
- return JSON.parse(fileContent);
136
+ const parsed = JSON.parse(fileContent);
137
+ return { ...getDefaultStructure(), ...parsed };
127
138
  }
128
139
 
129
140
  /*
@@ -283,4 +294,4 @@ module.exports = {
283
294
  getFavorites,
284
295
  TRACKER_DIR,
285
296
  COMMANDS_FILE,
286
- };
297
+ };
@@ -51,10 +51,26 @@ function showInitError() {
51
51
  * @returns {boolean} — true if valid, false if not
52
52
  */
53
53
  function isValidCategory(category) {
54
- const validCategories = [
55
- "git", "npm", "docker", "linux",
56
- "node", "angular", "python", "others"
57
- ];
54
+ const validCategories = [
55
+ "git",
56
+ "npm",
57
+ "docker",
58
+ "linux",
59
+ "node",
60
+ "angular",
61
+ "python",
62
+ "go",
63
+ "java",
64
+ "rust",
65
+ "dotnet",
66
+ "kubernetes",
67
+ "database",
68
+ "cloud",
69
+ "packagemanagers",
70
+ "testing",
71
+ "ai",
72
+ "others"
73
+ ];
58
74
  return validCategories.includes(category.toLowerCase());
59
75
  }
60
76
 
@@ -65,7 +81,7 @@ function isValidCategory(category) {
65
81
  */
66
82
  function showCategoryError(category) {
67
83
  console.log(`\n❌ Unknown category: "${category}"`);
68
- console.log("📋 Valid categories: git, npm, docker, linux, node, angular, python, others\n");
84
+ console.log("📋 Valid categories: git, npm, docker, linux, node, angular, python, go, java, rust, dotnet, kubernetes, database, cloud, packageManagers, testing, ai, others\n");
69
85
  }
70
86
 
71
87
  /*
@@ -91,4 +107,4 @@ module.exports = {
91
107
  isValidCategory,
92
108
  showCategoryError,
93
109
  isValidQuery
94
- };
110
+ };