aliasmate 1.0.0 → 1.3.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/CHANGELOG.md +159 -0
- package/README.md +188 -3
- package/dist/cli.js +66 -15
- package/dist/cli.js.map +1 -1
- package/dist/commands/delete.d.ts +12 -0
- package/dist/commands/delete.d.ts.map +1 -1
- package/dist/commands/delete.js +29 -8
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/edit.d.ts +13 -0
- package/dist/commands/edit.d.ts.map +1 -1
- package/dist/commands/edit.js +72 -26
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.d.ts +17 -0
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +42 -7
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.d.ts +21 -0
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +93 -48
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/list.d.ts +20 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +83 -6
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/prev.d.ts +14 -1
- package/dist/commands/prev.d.ts.map +1 -1
- package/dist/commands/prev.js +43 -14
- package/dist/commands/prev.js.map +1 -1
- package/dist/commands/run.d.ts +16 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +52 -11
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/save.d.ts +15 -1
- package/dist/commands/save.d.ts.map +1 -1
- package/dist/commands/save.js +82 -35
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/search.d.ts +19 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +113 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/storage/index.d.ts +44 -8
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +58 -12
- package/dist/storage/index.js.map +1 -1
- package/dist/utils/constants.d.ts +48 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +51 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/errors.d.ts +30 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +62 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/executor.d.ts +22 -1
- package/dist/utils/executor.d.ts.map +1 -1
- package/dist/utils/executor.js +36 -11
- package/dist/utils/executor.js.map +1 -1
- package/dist/utils/history.d.ts +21 -3
- package/dist/utils/history.d.ts.map +1 -1
- package/dist/utils/history.js +28 -14
- package/dist/utils/history.js.map +1 -1
- package/dist/utils/llm-generator.d.ts +21 -0
- package/dist/utils/llm-generator.d.ts.map +1 -0
- package/dist/utils/llm-generator.js +337 -0
- package/dist/utils/llm-generator.js.map +1 -0
- package/dist/utils/onboarding.d.ts +10 -0
- package/dist/utils/onboarding.d.ts.map +1 -0
- package/dist/utils/onboarding.js +201 -0
- package/dist/utils/onboarding.js.map +1 -0
- package/dist/utils/paths.d.ts +39 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +56 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/prompts.d.ts +56 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.js +51 -0
- package/dist/utils/prompts.js.map +1 -0
- package/package.json +22 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,163 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.0] - 2026-01-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Onboarding Experience**
|
|
12
|
+
- Welcome message and tour for first-time users
|
|
13
|
+
- Version upgrade notifications with new feature highlights
|
|
14
|
+
- Onboarding state tracking to avoid repeated messages
|
|
15
|
+
- Pro tips and helpful guidance for new users
|
|
16
|
+
- Installation date tracking
|
|
17
|
+
|
|
18
|
+
- **Path Mode Feature**
|
|
19
|
+
- New `pathMode` option for each saved command (`saved` or `current`)
|
|
20
|
+
- "Saved Directory" mode: Commands run in their saved directory (default, backward compatible)
|
|
21
|
+
- "Current Directory" mode: Commands run in user's current working directory
|
|
22
|
+
- Path mode selection during `aliasmate save` command
|
|
23
|
+
- Path mode editing via `aliasmate edit` command
|
|
24
|
+
- Path mode display in `aliasmate list` output with icons (📁 Saved / 📍 Current)
|
|
25
|
+
- Path mode indicator when running commands
|
|
26
|
+
- Backward compatibility with existing commands (defaults to 'saved' mode)
|
|
27
|
+
|
|
28
|
+
- **LLM Integration**
|
|
29
|
+
- Default "llm" command automatically created on first install
|
|
30
|
+
- Generates comprehensive `llm.txt` documentation file
|
|
31
|
+
- Includes all features, commands, best practices, and examples
|
|
32
|
+
- Designed for sharing with AI assistants (ChatGPT, Claude, etc.)
|
|
33
|
+
- Uses "current" path mode so users can generate the file anywhere
|
|
34
|
+
- 267 lines of detailed documentation
|
|
35
|
+
|
|
36
|
+
- **Enhanced User Experience**
|
|
37
|
+
- More informative output when saving commands with `prev` (shows path mode)
|
|
38
|
+
- Path mode hint in save confirmation messages
|
|
39
|
+
- Clear visual indicators for path modes in list output
|
|
40
|
+
- Better explanation of path modes in interactive prompts
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
- **API Changes**
|
|
44
|
+
- `CommandAlias` interface now includes optional `pathMode` field
|
|
45
|
+
- `setAlias()` function now accepts optional `pathMode` parameter (defaults to 'saved')
|
|
46
|
+
- `runCommand()` now respects path mode when no override path is provided
|
|
47
|
+
- All command operations preserve backward compatibility
|
|
48
|
+
|
|
49
|
+
- **Improvements**
|
|
50
|
+
- Enhanced list command output with path mode information
|
|
51
|
+
- Better visual hierarchy in command listings
|
|
52
|
+
- Improved help messages explaining path modes
|
|
53
|
+
- More descriptive prompts in interactive commands
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
- TypeScript compilation warnings for unused imports
|
|
57
|
+
|
|
58
|
+
## [1.2.0] - 2026-01-11
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
- **New Features**
|
|
62
|
+
- `search` (alias `find`) command to search commands by name, text, or directory
|
|
63
|
+
- Automatic backup creation before importing commands
|
|
64
|
+
- Success confirmation message for command execution
|
|
65
|
+
- Directory existence indicator in list output
|
|
66
|
+
- Command creation timestamp display in list output
|
|
67
|
+
- Enhanced config command showing directory, file path, and command count
|
|
68
|
+
- Exit code display for failed command executions
|
|
69
|
+
|
|
70
|
+
- **Security & Validation**
|
|
71
|
+
- Comprehensive input validation for command names (alphanumeric, hyphens, underscores only)
|
|
72
|
+
- Directory existence validation with warnings
|
|
73
|
+
- Path normalization to absolute paths for consistency
|
|
74
|
+
- Import data structure validation to prevent malformed data
|
|
75
|
+
- Empty input validation for all prompts
|
|
76
|
+
- Command execution validation (directory exists and is actually a directory)
|
|
77
|
+
|
|
78
|
+
- **Error Handling**
|
|
79
|
+
- Global uncaught exception handler
|
|
80
|
+
- Global unhandled promise rejection handler
|
|
81
|
+
- Enhanced error messages with more context
|
|
82
|
+
- Try-catch blocks around all setAlias operations
|
|
83
|
+
- Improved error messages for specific scenarios
|
|
84
|
+
|
|
85
|
+
- **Utility Functions**
|
|
86
|
+
- `isValidDirectory()` for directory validation
|
|
87
|
+
- `sanitizeCommandName()` for input sanitization
|
|
88
|
+
- Atomic file write operations to prevent corruption
|
|
89
|
+
- Exit code tracking in command execution results
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
- **Improvements**
|
|
93
|
+
- Delete command now shows details of what will be deleted
|
|
94
|
+
- Export command creates parent directories if they don't exist
|
|
95
|
+
- Export command warns when overwriting existing files
|
|
96
|
+
- Import command validates each alias structure before processing
|
|
97
|
+
- All user inputs are trimmed before processing
|
|
98
|
+
- All directory paths are normalized to absolute paths
|
|
99
|
+
- Enhanced rename validation in import conflict resolution
|
|
100
|
+
|
|
101
|
+
- **Code Quality**
|
|
102
|
+
- Consistent input validation across all commands
|
|
103
|
+
- Better error propagation with context
|
|
104
|
+
- Improved command execution error reporting
|
|
105
|
+
- Enhanced CLI help messages for unknown commands
|
|
106
|
+
|
|
107
|
+
### Fixed
|
|
108
|
+
- Atomic write operations prevent config file corruption during saves
|
|
109
|
+
- Proper validation of command names to prevent special characters
|
|
110
|
+
- Directory validation prevents execution errors
|
|
111
|
+
- Input trimming prevents whitespace-related issues
|
|
112
|
+
- Better error handling for setAlias validation errors
|
|
113
|
+
|
|
114
|
+
### Developer Notes
|
|
115
|
+
- **Breaking Changes**: None - fully backward compatible
|
|
116
|
+
- **Migration**: No migration needed
|
|
117
|
+
- All changes enhance existing functionality
|
|
118
|
+
- New search command provides additional value
|
|
119
|
+
- Improved data safety through atomic operations and backups
|
|
120
|
+
|
|
121
|
+
## [1.1.0] - 2026-01-08
|
|
122
|
+
|
|
123
|
+
### Added
|
|
124
|
+
- **Developer Experience**
|
|
125
|
+
- ESLint configuration with TypeScript support for code quality enforcement
|
|
126
|
+
- Prettier configuration for consistent code formatting
|
|
127
|
+
- Comprehensive JSDoc documentation for all public functions
|
|
128
|
+
- CONTRIBUTING.md with detailed contributor guidelines
|
|
129
|
+
- DEV_GUIDE.md for quick development reference
|
|
130
|
+
- New npm scripts: `lint`, `lint:fix`, `format`, `format:check`, `typecheck`
|
|
131
|
+
|
|
132
|
+
- **Code Quality**
|
|
133
|
+
- Centralized error handling utilities (`src/utils/errors.ts`)
|
|
134
|
+
- Standardized error messages and constants (`src/utils/constants.ts`)
|
|
135
|
+
- Custom error types and exit code enums
|
|
136
|
+
- Proper TypeScript type annotations throughout codebase
|
|
137
|
+
|
|
138
|
+
### Changed
|
|
139
|
+
- **Refactoring**
|
|
140
|
+
- Removed all `any` types, replaced with proper TypeScript interfaces
|
|
141
|
+
- Standardized error handling across all commands
|
|
142
|
+
- Eliminated code duplication (30+ duplicate strings removed)
|
|
143
|
+
- Improved type safety for inquirer prompt responses
|
|
144
|
+
- Updated all command files to use centralized error utilities
|
|
145
|
+
- Better JSDoc documentation with usage examples for all functions
|
|
146
|
+
|
|
147
|
+
- **Code Organization**
|
|
148
|
+
- Extracted common error handling patterns to utilities
|
|
149
|
+
- Centralized all user-facing messages in constants
|
|
150
|
+
- Removed unused function parameters
|
|
151
|
+
- Improved import organization (Node → External → Internal)
|
|
152
|
+
|
|
153
|
+
### Fixed
|
|
154
|
+
- Proper typing for execa error handling
|
|
155
|
+
- Consistent exit codes across all error scenarios
|
|
156
|
+
- Fixed async/await usage where not needed
|
|
157
|
+
|
|
158
|
+
### Developer Notes
|
|
159
|
+
- **Breaking Changes**: None - this is a code quality improvement release
|
|
160
|
+
- **Migration**: No migration needed, fully backward compatible
|
|
161
|
+
- All code now passes TypeScript strict mode compilation
|
|
162
|
+
- ESLint: 0 errors, 5 acceptable warnings (from inquirer library types)
|
|
163
|
+
- 100% of functions now have comprehensive JSDoc documentation
|
|
164
|
+
|
|
8
165
|
## [1.0.0] - 2025-11-15
|
|
9
166
|
|
|
10
167
|
### Added
|
|
@@ -33,4 +190,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
33
190
|
- Input validation and error handling
|
|
34
191
|
- Beautiful CLI output with chalk
|
|
35
192
|
|
|
193
|
+
[1.2.0]: https://github.com/aliasmate/aliasmate/releases/tag/v1.2.0
|
|
194
|
+
[1.1.0]: https://github.com/aliasmate/aliasmate/releases/tag/v1.1.0
|
|
36
195
|
[1.0.0]: https://github.com/aliasmate/aliasmate/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
A powerful CLI utility to save, manage, and re-run shell commands with their working directories. Never lose track of useful commands again!
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/aliasmate)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://www.typescriptlang.org/)
|
|
8
|
+
[](https://github.com/prettier/prettier)
|
|
9
|
+
|
|
5
10
|
## Why Use AliasMate?
|
|
6
11
|
|
|
7
12
|
As developers, we often spend time crafting complex commands, navigating to specific directories, and repeating the same sequences. AliasMate solves this by:
|
|
@@ -18,12 +23,15 @@ Whether you're a solo developer or part of a team, AliasMate helps you streamlin
|
|
|
18
23
|
|
|
19
24
|
- 🚀 **Save previous commands** from shell history with one simple command
|
|
20
25
|
- 📂 **Remember working directories** where commands should be executed
|
|
26
|
+
- 🎯 **Path mode selection** - Choose between saved directory or current directory execution
|
|
21
27
|
- ⚡ **Quick execution** of saved commands with optional path override
|
|
22
28
|
- 📝 **Interactive save** with prompts for command and path
|
|
23
29
|
- 📋 **List all saved commands** with their details
|
|
24
30
|
- ✏️ **Edit commands** interactively
|
|
25
31
|
- 🗑️ **Delete unwanted commands**
|
|
26
32
|
- 📤 **Export/Import** commands for backup or sharing
|
|
33
|
+
- 🤖 **LLM Integration** - Default command to generate comprehensive documentation
|
|
34
|
+
- 🎉 **Onboarding experience** - Welcome tour for first-time users
|
|
27
35
|
- 🎨 **Beautiful colored output** for better readability
|
|
28
36
|
- 🔄 **Cross-platform** support (Linux, macOS, Windows)
|
|
29
37
|
|
|
@@ -38,7 +46,9 @@ npm i -g aliasmate
|
|
|
38
46
|
## Getting Started
|
|
39
47
|
|
|
40
48
|
1. **Install AliasMate** using the command above.
|
|
41
|
-
2. **
|
|
49
|
+
2. **Welcome Tour**: On first run, you'll see a helpful welcome message and quick tour explaining how AliasMate works.
|
|
50
|
+
3. **Default LLM Command**: A default "llm" command is automatically created that generates comprehensive documentation for AI assistants.
|
|
51
|
+
4. **Save a command**: After running any useful command in your terminal, save it with `aliasmate prev <name>`. For example:
|
|
42
52
|
```bash
|
|
43
53
|
npm run build
|
|
44
54
|
aliasmate prev build
|
|
@@ -103,6 +113,62 @@ You'll be prompted for:
|
|
|
103
113
|
- Command name
|
|
104
114
|
- Command to save
|
|
105
115
|
- Working directory (defaults to current directory)
|
|
116
|
+
- **Path mode** (NEW): Choose whether to run in saved directory or current directory
|
|
117
|
+
|
|
118
|
+
### Path Mode Feature
|
|
119
|
+
|
|
120
|
+
AliasMate now supports two path modes for each saved command:
|
|
121
|
+
|
|
122
|
+
#### Saved Directory Mode (Default)
|
|
123
|
+
Commands always run in the directory where they were saved. Perfect for project-specific commands.
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Save a build command for a specific project
|
|
127
|
+
cd /path/to/my-project
|
|
128
|
+
npm run build
|
|
129
|
+
aliasmate prev build
|
|
130
|
+
|
|
131
|
+
# Later, run from anywhere - it executes in /path/to/my-project
|
|
132
|
+
cd ~
|
|
133
|
+
aliasmate run build # Runs in /path/to/my-project
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Current Directory Mode
|
|
137
|
+
Commands run in your current working directory. Ideal for general-purpose utilities.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Save a command with current directory mode
|
|
141
|
+
aliasmate save
|
|
142
|
+
# Enter name: lint
|
|
143
|
+
# Enter command: eslint .
|
|
144
|
+
# Enter directory: /any/path (doesn't matter)
|
|
145
|
+
# Choose: Current Directory
|
|
146
|
+
|
|
147
|
+
# Later, runs in whichever directory you're in
|
|
148
|
+
cd /path/to/project-a
|
|
149
|
+
aliasmate run lint # Lints project-a
|
|
150
|
+
|
|
151
|
+
cd /path/to/project-b
|
|
152
|
+
aliasmate run lint # Lints project-b
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
You can change the path mode anytime using `aliasmate edit <name>`.
|
|
156
|
+
|
|
157
|
+
### Generate LLM Documentation
|
|
158
|
+
|
|
159
|
+
AliasMate includes a default command that generates comprehensive documentation for AI assistants:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
aliasmate run llm
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
This creates an `llm.txt` file in your current directory containing:
|
|
166
|
+
- Complete feature documentation
|
|
167
|
+
- All available commands and their usage
|
|
168
|
+
- Best practices and examples
|
|
169
|
+
- Integration tips for AI assistants
|
|
170
|
+
|
|
171
|
+
Share this file with AI assistants like ChatGPT or Claude for better help with AliasMate!
|
|
106
172
|
|
|
107
173
|
### List All Saved Commands
|
|
108
174
|
|
|
@@ -273,20 +339,139 @@ cd aliasmate
|
|
|
273
339
|
# Install dependencies
|
|
274
340
|
npm install
|
|
275
341
|
|
|
276
|
-
#
|
|
342
|
+
# Build the project
|
|
343
|
+
npm run build
|
|
344
|
+
|
|
345
|
+
# Run type checking
|
|
346
|
+
npm run typecheck
|
|
347
|
+
|
|
348
|
+
# Lint the code
|
|
349
|
+
npm run lint
|
|
350
|
+
|
|
351
|
+
# Format code
|
|
352
|
+
npm run format
|
|
353
|
+
|
|
354
|
+
# Link for local testing
|
|
277
355
|
npm link
|
|
278
356
|
|
|
279
357
|
# Test the CLI
|
|
280
358
|
aliasmate --help
|
|
281
359
|
```
|
|
282
360
|
|
|
361
|
+
### Development Scripts
|
|
362
|
+
|
|
363
|
+
| Script | Description |
|
|
364
|
+
|--------|-------------|
|
|
365
|
+
| `npm run build` | Compile TypeScript to JavaScript |
|
|
366
|
+
| `npm run dev` | Watch mode for development |
|
|
367
|
+
| `npm run typecheck` | Run TypeScript type checking |
|
|
368
|
+
| `npm run lint` | Check code quality with ESLint |
|
|
369
|
+
| `npm run lint:fix` | Auto-fix ESLint issues |
|
|
370
|
+
| `npm run format` | Format code with Prettier |
|
|
371
|
+
| `npm run format:check` | Check if code is formatted |
|
|
372
|
+
|
|
373
|
+
### Code Quality
|
|
374
|
+
|
|
375
|
+
AliasMate is built with modern development practices:
|
|
376
|
+
|
|
377
|
+
- ✅ **TypeScript** with strict mode enabled
|
|
378
|
+
- ✅ **ESLint** for code quality enforcement
|
|
379
|
+
- ✅ **Prettier** for consistent formatting
|
|
380
|
+
- ✅ **Comprehensive JSDoc** documentation
|
|
381
|
+
- ✅ **Centralized error handling** with proper exit codes
|
|
382
|
+
- ✅ **Zero type safety warnings** in production code
|
|
383
|
+
|
|
384
|
+
For detailed contribution guidelines, see [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
385
|
+
|
|
386
|
+
## Project Structure
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
aliasmate/
|
|
390
|
+
├── src/
|
|
391
|
+
│ ├── cli.ts # CLI entry point
|
|
392
|
+
│ ├── commands/ # Command implementations
|
|
393
|
+
│ │ ├── prev.ts # Save from history
|
|
394
|
+
│ │ ├── run.ts # Execute commands
|
|
395
|
+
│ │ ├── save.ts # Interactive save
|
|
396
|
+
│ │ ├── list.ts # Display all
|
|
397
|
+
│ │ ├── edit.ts # Modify commands
|
|
398
|
+
│ │ ├── delete.ts # Remove commands
|
|
399
|
+
│ │ ├── export.ts # Backup to JSON
|
|
400
|
+
│ │ └── import.ts # Restore from JSON
|
|
401
|
+
│ ├── storage/
|
|
402
|
+
│ │ └── index.ts # Config persistence
|
|
403
|
+
│ └── utils/
|
|
404
|
+
│ ├── constants.ts # Shared constants
|
|
405
|
+
│ ├── errors.ts # Error handling
|
|
406
|
+
│ ├── executor.ts # Command execution
|
|
407
|
+
│ ├── history.ts # Shell integration
|
|
408
|
+
│ └── paths.ts # Path utilities
|
|
409
|
+
├── dist/ # Compiled output
|
|
410
|
+
└── docs/
|
|
411
|
+
├── CONTRIBUTING.md # Contributor guide
|
|
412
|
+
├── DEV_GUIDE.md # Quick reference
|
|
413
|
+
└── CLEANUP_SUMMARY.md # Code quality report
|
|
414
|
+
```
|
|
415
|
+
|
|
283
416
|
## License
|
|
284
417
|
|
|
285
418
|
MIT
|
|
286
419
|
|
|
287
420
|
## Contributing
|
|
288
421
|
|
|
289
|
-
Contributions are welcome!
|
|
422
|
+
Contributions are welcome! We appreciate:
|
|
423
|
+
|
|
424
|
+
- 🐛 Bug reports and fixes
|
|
425
|
+
- ✨ Feature suggestions and implementations
|
|
426
|
+
- 📝 Documentation improvements
|
|
427
|
+
|
|
428
|
+
**Maintainer**: AliasMate Contributors
|
|
429
|
+
|
|
430
|
+
## Changelog
|
|
431
|
+
|
|
432
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
433
|
+
|
|
434
|
+
## Support
|
|
435
|
+
|
|
436
|
+
- 📖 [Documentation](./README.md)
|
|
437
|
+
- 🐛 [Issue Tracker](https://github.com/aliasmate/aliasmate/issues)
|
|
438
|
+
- 💬 [Discussions](https://github.com/aliasmate/aliasmate/discussions)
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
**⭐ If you find AliasMate helpful, please consider giving it a star on GitHub!**
|
|
443
|
+
- 🎨 Code quality enhancements
|
|
444
|
+
|
|
445
|
+
Before contributing, please:
|
|
446
|
+
|
|
447
|
+
1. Read our [Contributing Guide](./CONTRIBUTING.md)
|
|
448
|
+
2. Check existing issues and pull requests
|
|
449
|
+
3. Follow the code style (ESLint + Prettier)
|
|
450
|
+
4. Add tests for new features (when applicable)
|
|
451
|
+
5. Update documentation as needed
|
|
452
|
+
|
|
453
|
+
### Quick Start for Contributors
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
# Fork and clone the repository
|
|
457
|
+
git clone https://github.com/YOUR_USERNAME/aliasmate.git
|
|
458
|
+
cd aliasmate
|
|
459
|
+
|
|
460
|
+
# Install dependencies
|
|
461
|
+
npm install
|
|
462
|
+
|
|
463
|
+
# Make your changes, then:
|
|
464
|
+
npm run format # Format code
|
|
465
|
+
npm run lint # Check for issues
|
|
466
|
+
npm run typecheck # Verify types
|
|
467
|
+
npm run build # Build project
|
|
468
|
+
|
|
469
|
+
# Test locally
|
|
470
|
+
npm link
|
|
471
|
+
aliasmate --help
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
See [DEV_GUIDE.md](./DEV_GUIDE.md) for detailed development workflows.
|
|
290
475
|
|
|
291
476
|
## Author
|
|
292
477
|
|
package/dist/cli.js
CHANGED
|
@@ -14,32 +14,48 @@ const delete_1 = require("./commands/delete");
|
|
|
14
14
|
const edit_1 = require("./commands/edit");
|
|
15
15
|
const export_1 = require("./commands/export");
|
|
16
16
|
const import_1 = require("./commands/import");
|
|
17
|
+
const search_1 = require("./commands/search");
|
|
17
18
|
const storage_1 = require("./storage");
|
|
19
|
+
const constants_1 = require("./utils/constants");
|
|
20
|
+
const onboarding_1 = require("./utils/onboarding");
|
|
21
|
+
const llm_generator_1 = require("./utils/llm-generator");
|
|
22
|
+
// Check for first install or upgrade and show onboarding
|
|
23
|
+
const onboardingShown = (0, onboarding_1.checkAndShowOnboarding)();
|
|
24
|
+
// Create default LLM command if it doesn't exist
|
|
25
|
+
if (!(0, storage_1.aliasExists)('llm')) {
|
|
26
|
+
const llmCmd = (0, llm_generator_1.getDefaultLLMCommand)();
|
|
27
|
+
(0, storage_1.setAlias)(llmCmd.name, llmCmd.command, llmCmd.directory, llmCmd.pathMode);
|
|
28
|
+
if (onboardingShown) {
|
|
29
|
+
console.log(chalk_1.default.green('✓ Default "llm" command has been created'));
|
|
30
|
+
console.log(chalk_1.default.gray(` Run ${chalk_1.default.cyan('aliasmate run llm')} to generate llm.txt`));
|
|
31
|
+
console.log();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
18
34
|
const program = new commander_1.Command();
|
|
19
35
|
program
|
|
20
36
|
.name('aliasmate')
|
|
21
37
|
.description('A CLI utility to save, manage, and re-run shell commands with their working directories')
|
|
22
|
-
.version(
|
|
38
|
+
.version(constants_1.APP_VERSION);
|
|
23
39
|
// prev command - save previous command from history
|
|
24
40
|
program
|
|
25
41
|
.command('prev <name>')
|
|
26
42
|
.description('Save the previous command from shell history')
|
|
27
|
-
.action((name
|
|
28
|
-
(0, prev_1.prevCommand)(name,
|
|
43
|
+
.action((name) => {
|
|
44
|
+
(0, prev_1.prevCommand)(name, process.cwd());
|
|
29
45
|
});
|
|
30
46
|
// run command - execute a saved command
|
|
31
47
|
program
|
|
32
48
|
.command('run <name> [path]')
|
|
33
49
|
.description('Run a saved command (optionally override the working directory)')
|
|
34
|
-
.action((name, path
|
|
35
|
-
(0, run_1.runCommand)(name, path
|
|
50
|
+
.action((name, path) => {
|
|
51
|
+
void (0, run_1.runCommand)(name, path);
|
|
36
52
|
});
|
|
37
53
|
// save command - interactively save a new command
|
|
38
54
|
program
|
|
39
55
|
.command('save')
|
|
40
56
|
.description('Interactively save a new command')
|
|
41
|
-
.action((
|
|
42
|
-
(0, save_1.saveCommand)(
|
|
57
|
+
.action(() => {
|
|
58
|
+
void (0, save_1.saveCommand)(process.cwd());
|
|
43
59
|
});
|
|
44
60
|
// list commands
|
|
45
61
|
program
|
|
@@ -49,6 +65,14 @@ program
|
|
|
49
65
|
.action(() => {
|
|
50
66
|
(0, list_1.listCommand)();
|
|
51
67
|
});
|
|
68
|
+
// search commands
|
|
69
|
+
program
|
|
70
|
+
.command('search <query>')
|
|
71
|
+
.alias('find')
|
|
72
|
+
.description('Search for commands by name, command text, or directory')
|
|
73
|
+
.action((query) => {
|
|
74
|
+
(0, search_1.searchCommand)(query);
|
|
75
|
+
});
|
|
52
76
|
// delete command
|
|
53
77
|
program
|
|
54
78
|
.command('delete <name>')
|
|
@@ -62,7 +86,7 @@ program
|
|
|
62
86
|
.command('edit <name>')
|
|
63
87
|
.description('Edit a saved command')
|
|
64
88
|
.action((name) => {
|
|
65
|
-
(0, edit_1.editCommand)(name);
|
|
89
|
+
void (0, edit_1.editCommand)(name);
|
|
66
90
|
});
|
|
67
91
|
// export commands
|
|
68
92
|
program
|
|
@@ -76,23 +100,50 @@ program
|
|
|
76
100
|
.command('import <file>')
|
|
77
101
|
.description('Import commands from a JSON file')
|
|
78
102
|
.action((file) => {
|
|
79
|
-
(0, import_1.importCommand)(file);
|
|
103
|
+
void (0, import_1.importCommand)(file);
|
|
80
104
|
});
|
|
81
105
|
// config command - show config location
|
|
82
106
|
program
|
|
83
107
|
.command('config')
|
|
84
|
-
.description('Show the location of the config file')
|
|
108
|
+
.description('Show the location of the config file and directory')
|
|
85
109
|
.action(() => {
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
const aliases = (0, storage_1.loadAliases)();
|
|
111
|
+
const commandCount = Object.keys(aliases).length;
|
|
112
|
+
console.log(chalk_1.default.blue('AliasMate Configuration:'));
|
|
113
|
+
console.log(chalk_1.default.gray(` Config directory: ${(0, storage_1.getConfigDir)()}`));
|
|
114
|
+
console.log(chalk_1.default.gray(` Config file: ${(0, storage_1.getConfigPath)()}`));
|
|
115
|
+
console.log(chalk_1.default.gray(` Saved commands: ${commandCount}`));
|
|
88
116
|
});
|
|
89
117
|
// Handle unknown commands
|
|
90
118
|
program.on('command:*', () => {
|
|
91
|
-
console.error(chalk_1.default.red('
|
|
92
|
-
console.log(chalk_1.default.yellow('
|
|
119
|
+
console.error(chalk_1.default.red('Error: Unknown command "%s"'), program.args.join(' '));
|
|
120
|
+
console.log(chalk_1.default.yellow('\nAvailable commands:'));
|
|
121
|
+
console.log(chalk_1.default.gray(' prev <name> - Save previous command from history'));
|
|
122
|
+
console.log(chalk_1.default.gray(' run <name> [path] - Run a saved command'));
|
|
123
|
+
console.log(chalk_1.default.gray(' save - Interactively save a command'));
|
|
124
|
+
console.log(chalk_1.default.gray(' list (ls) - List all saved commands'));
|
|
125
|
+
console.log(chalk_1.default.gray(' search <query> - Search for commands'));
|
|
126
|
+
console.log(chalk_1.default.gray(' edit <name> - Edit a saved command'));
|
|
127
|
+
console.log(chalk_1.default.gray(' delete <name> - Delete a saved command'));
|
|
128
|
+
console.log(chalk_1.default.gray(' export <file> - Export commands to JSON'));
|
|
129
|
+
console.log(chalk_1.default.gray(' import <file> - Import commands from JSON'));
|
|
130
|
+
console.log(chalk_1.default.gray(' config - Show config file location'));
|
|
131
|
+
console.log(chalk_1.default.yellow('\nUse --help for more information.'));
|
|
132
|
+
process.exit(1);
|
|
133
|
+
});
|
|
134
|
+
// Add global error handler
|
|
135
|
+
process.on('uncaughtException', (error) => {
|
|
136
|
+
console.error(chalk_1.default.red('\nUnexpected error:'), error.message);
|
|
137
|
+
if (process.env.DEBUG) {
|
|
138
|
+
console.error(error.stack);
|
|
139
|
+
}
|
|
140
|
+
process.exit(1);
|
|
141
|
+
});
|
|
142
|
+
process.on('unhandledRejection', (reason) => {
|
|
143
|
+
console.error(chalk_1.default.red('\nUnhandled promise rejection:'), reason);
|
|
93
144
|
process.exit(1);
|
|
94
145
|
});
|
|
95
|
-
// Parse arguments
|
|
146
|
+
// Parse command line arguments
|
|
96
147
|
program.parse(process.argv);
|
|
97
148
|
// Show help if no arguments provided
|
|
98
149
|
if (!process.argv.slice(2).length) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,0CAA8C;AAC9C,wCAA4C;AAC5C,0CAA8C;AAC9C,0CAA8C;AAC9C,8CAAkD;AAClD,0CAA8C;AAC9C,8CAAkD;AAClD,8CAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,0CAA8C;AAC9C,wCAA4C;AAC5C,0CAA8C;AAC9C,0CAA8C;AAC9C,8CAAkD;AAClD,0CAA8C;AAC9C,8CAAkD;AAClD,8CAAkD;AAClD,8CAAkD;AAClD,uCAA4F;AAC5F,iDAAgD;AAChD,mDAA4D;AAC5D,yDAA6D;AAE7D,yDAAyD;AACzD,MAAM,eAAe,GAAG,IAAA,mCAAsB,GAAE,CAAC;AAEjD,iDAAiD;AACjD,IAAI,CAAC,IAAA,qBAAW,EAAC,KAAK,CAAC,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,IAAA,oCAAoB,GAAE,CAAC;IACtC,IAAA,kBAAQ,EAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEzE,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,CAAC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AO,CAAC,IAAI,CAAC,CAAC;AAE5B,qCAAqC;AACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delete a saved command by name
|
|
3
|
+
*
|
|
4
|
+
* @param name - The name of the command to delete
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* // Delete a command
|
|
9
|
+
* deleteCommand('old-build');
|
|
10
|
+
* // Output: ✓ Deleted command "old-build"
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
1
13
|
export declare function deleteCommand(name: string): void;
|
|
2
14
|
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAgChD"}
|
package/dist/commands/delete.js
CHANGED
|
@@ -6,28 +6,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.deleteCommand = deleteCommand;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const storage_1 = require("../storage");
|
|
9
|
+
const errors_1 = require("../utils/errors");
|
|
10
|
+
const constants_1 = require("../utils/constants");
|
|
11
|
+
/**
|
|
12
|
+
* Delete a saved command by name
|
|
13
|
+
*
|
|
14
|
+
* @param name - The name of the command to delete
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```
|
|
18
|
+
* // Delete a command
|
|
19
|
+
* deleteCommand('old-build');
|
|
20
|
+
* // Output: ✓ Deleted command "old-build"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
9
23
|
function deleteCommand(name) {
|
|
10
24
|
try {
|
|
25
|
+
// Validate command name
|
|
26
|
+
if (!name || !name.trim()) {
|
|
27
|
+
(0, errors_1.exitWithError)('Command name cannot be empty', errors_1.ExitCode.InvalidInput);
|
|
28
|
+
}
|
|
11
29
|
// Check if alias exists
|
|
12
30
|
const alias = (0, storage_1.getAlias)(name);
|
|
13
31
|
if (!alias) {
|
|
14
|
-
console.error(chalk_1.default.red(`Error:
|
|
15
|
-
console.log(chalk_1.default.yellow(
|
|
16
|
-
process.exit(
|
|
32
|
+
console.error(chalk_1.default.red(`Error: ${constants_1.ERROR_MESSAGES.commandNotFound(name)}`));
|
|
33
|
+
console.log(chalk_1.default.yellow(constants_1.HELP_MESSAGES.useList));
|
|
34
|
+
process.exit(errors_1.ExitCode.InvalidInput);
|
|
17
35
|
}
|
|
36
|
+
// Show what will be deleted
|
|
37
|
+
console.log(chalk_1.default.yellow(`About to delete:`));
|
|
38
|
+
console.log(chalk_1.default.gray(` Name: ${name}`));
|
|
39
|
+
console.log(chalk_1.default.gray(` Command: ${alias.command}`));
|
|
40
|
+
console.log(chalk_1.default.gray(` Directory: ${alias.directory}\n`));
|
|
18
41
|
// Delete the alias
|
|
19
42
|
const success = (0, storage_1.deleteAlias)(name);
|
|
20
43
|
if (success) {
|
|
21
|
-
console.log(chalk_1.default.green(`✓
|
|
44
|
+
console.log(chalk_1.default.green(`✓ ${constants_1.SUCCESS_MESSAGES.deleted(name)}`));
|
|
22
45
|
}
|
|
23
46
|
else {
|
|
24
|
-
|
|
25
|
-
process.exit(1);
|
|
47
|
+
(0, errors_1.exitWithError)(constants_1.ERROR_MESSAGES.couldNotDelete);
|
|
26
48
|
}
|
|
27
49
|
}
|
|
28
50
|
catch (error) {
|
|
29
|
-
|
|
30
|
-
process.exit(1);
|
|
51
|
+
(0, errors_1.handleError)(error, 'Failed to delete command');
|
|
31
52
|
}
|
|
32
53
|
}
|
|
33
54
|
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":";;;;;AAiBA,sCAgCC;AAjDD,kDAA0B;AAC1B,wCAAmD;AACnD,4CAAuE;AACvE,kDAAqF;AAErF;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,IAAI,CAAC;QACH,wBAAwB;QACxB,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1B,IAAA,sBAAa,EAAC,8BAA8B,EAAE,iBAAQ,CAAC,YAAY,CAAC,CAAC;QACvE,CAAC;QAED,wBAAwB;QACxB,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,UAAU,0BAAc,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3E,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,yBAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,iBAAQ,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC;QAED,4BAA4B;QAC5B,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,cAAc,KAAK,CAAC,OAAO,E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