aliasmate 1.0.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +21 -0
  3. package/README.md +293 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +101 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/delete.d.ts +2 -0
  9. package/dist/commands/delete.d.ts.map +1 -0
  10. package/dist/commands/delete.js +33 -0
  11. package/dist/commands/delete.js.map +1 -0
  12. package/dist/commands/edit.d.ts +2 -0
  13. package/dist/commands/edit.d.ts.map +1 -0
  14. package/dist/commands/edit.js +68 -0
  15. package/dist/commands/edit.js.map +1 -0
  16. package/dist/commands/export.d.ts +2 -0
  17. package/dist/commands/export.d.ts.map +1 -0
  18. package/dist/commands/export.js +74 -0
  19. package/dist/commands/export.js.map +1 -0
  20. package/dist/commands/import.d.ts +2 -0
  21. package/dist/commands/import.d.ts.map +1 -0
  22. package/dist/commands/import.js +190 -0
  23. package/dist/commands/import.js.map +1 -0
  24. package/dist/commands/list.d.ts +2 -0
  25. package/dist/commands/list.d.ts.map +1 -0
  26. package/dist/commands/list.js +34 -0
  27. package/dist/commands/list.js.map +1 -0
  28. package/dist/commands/prev.d.ts +2 -0
  29. package/dist/commands/prev.d.ts.map +1 -0
  30. package/dist/commands/prev.js +40 -0
  31. package/dist/commands/prev.js.map +1 -0
  32. package/dist/commands/run.d.ts +2 -0
  33. package/dist/commands/run.d.ts.map +1 -0
  34. package/dist/commands/run.js +43 -0
  35. package/dist/commands/run.js.map +1 -0
  36. package/dist/commands/save.d.ts +2 -0
  37. package/dist/commands/save.d.ts.map +1 -0
  38. package/dist/commands/save.js +83 -0
  39. package/dist/commands/save.js.map +1 -0
  40. package/dist/storage/index.d.ts +42 -0
  41. package/dist/storage/index.d.ts.map +1 -0
  42. package/dist/storage/index.js +134 -0
  43. package/dist/storage/index.js.map +1 -0
  44. package/dist/utils/executor.d.ts +11 -0
  45. package/dist/utils/executor.d.ts.map +1 -0
  46. package/dist/utils/executor.js +76 -0
  47. package/dist/utils/executor.js.map +1 -0
  48. package/dist/utils/history.d.ts +19 -0
  49. package/dist/utils/history.d.ts.map +1 -0
  50. package/dist/utils/history.js +161 -0
  51. package/dist/utils/history.js.map +1 -0
  52. package/dist/utils/paths.d.ts +6 -0
  53. package/dist/utils/paths.d.ts.map +1 -0
  54. package/dist/utils/paths.js +60 -0
  55. package/dist/utils/paths.js.map +1 -0
  56. package/package.json +57 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2025-11-15
9
+
10
+ ### Added
11
+ - Initial release
12
+ - `prev` command to save previous shell command
13
+ - `run` command to execute saved commands
14
+ - `save` command for interactive command saving
15
+ - `list` (alias `ls`) command to display all saved commands
16
+ - `edit` command to modify saved commands
17
+ - `delete` (alias `rm`) command to remove saved commands
18
+ - `export` command to backup commands to JSON
19
+ - `import` command to restore commands from JSON
20
+ - `config` command to show config file location
21
+ - Cross-platform support (Linux, macOS, Windows)
22
+ - Colored terminal output
23
+ - Working directory preservation and override
24
+ - Interactive conflict resolution for imports
25
+ - Automatic config directory creation
26
+
27
+ ### Features
28
+ - Save commands with their original working directory
29
+ - Override working directory when running commands
30
+ - Export/import with conflict handling (overwrite/skip/rename)
31
+ - Read from shell history (bash, zsh)
32
+ - Persistent storage in user config directory
33
+ - Input validation and error handling
34
+ - Beautiful CLI output with chalk
35
+
36
+ [1.0.0]: https://github.com/aliasmate/aliasmate/releases/tag/v1.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 aliasmate
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,293 @@
1
+ # AliasMate
2
+
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
+
5
+ ## Why Use AliasMate?
6
+
7
+ As developers, we often spend time crafting complex commands, navigating to specific directories, and repeating the same sequences. AliasMate solves this by:
8
+
9
+ - **Saving Time**: Quickly save and rerun frequently used commands without retyping them.
10
+ - **Reducing Errors**: Execute commands in their correct directories, avoiding path-related mistakes.
11
+ - **Boosting Productivity**: Focus on coding instead of remembering command syntax and locations.
12
+ - **Sharing Knowledge**: Export and import commands to share workflows with your team.
13
+ - **Organizing Workflows**: Keep your development environment clean and organized with named, reusable commands.
14
+
15
+ Whether you're a solo developer or part of a team, AliasMate helps you streamline your terminal workflow and maintain consistency across projects.
16
+
17
+ ## Features
18
+
19
+ - 🚀 **Save previous commands** from shell history with one simple command
20
+ - 📂 **Remember working directories** where commands should be executed
21
+ - ⚡ **Quick execution** of saved commands with optional path override
22
+ - 📝 **Interactive save** with prompts for command and path
23
+ - 📋 **List all saved commands** with their details
24
+ - ✏️ **Edit commands** interactively
25
+ - 🗑️ **Delete unwanted commands**
26
+ - 📤 **Export/Import** commands for backup or sharing
27
+ - 🎨 **Beautiful colored output** for better readability
28
+ - 🔄 **Cross-platform** support (Linux, macOS, Windows)
29
+
30
+ ## Installation
31
+
32
+ Install globally via npm:
33
+
34
+ ```bash
35
+ npm i -g aliasmate
36
+ ```
37
+
38
+ ## Getting Started
39
+
40
+ 1. **Install AliasMate** using the command above.
41
+ 2. **Save a command**: After running any useful command in your terminal, save it with `aliasmate prev <name>`. For example:
42
+ ```bash
43
+ npm run build
44
+ aliasmate prev build
45
+ ```
46
+ 3. **Run the command**: From anywhere, execute it with `aliasmate run <name>`:
47
+ ```bash
48
+ aliasmate run build
49
+ ```
50
+ 4. **Explore more**: Use `aliasmate list` to see all saved commands, `aliasmate edit <name>` to modify them, and more!
51
+
52
+ ## Usage
53
+
54
+ ### Save the Previous Command
55
+
56
+ Automatically capture the last command you ran:
57
+
58
+ ```bash
59
+ # After running any command, save it
60
+ aliasmate prev <name>
61
+ ```
62
+
63
+ **Example:**
64
+ ```bash
65
+ npm run build
66
+ aliasmate prev build
67
+ # ✓ Saved command as "build"
68
+ # Command: npm run build
69
+ # Directory: /path/to/project
70
+ ```
71
+
72
+ ### Run a Saved Command
73
+
74
+ Execute a saved command in its original directory:
75
+
76
+ ```bash
77
+ aliasmate run <name>
78
+ ```
79
+
80
+ Or override the directory:
81
+
82
+ ```bash
83
+ aliasmate run <name> .
84
+ aliasmate run <name> /path/to/another/project
85
+ ```
86
+
87
+ **Example:**
88
+ ```bash
89
+ aliasmate run build
90
+ # Running: npm run build
91
+ # Directory: /path/to/project
92
+ ```
93
+
94
+ ### Save a Command Interactively
95
+
96
+ Manually save a command with interactive prompts:
97
+
98
+ ```bash
99
+ aliasmate save
100
+ ```
101
+
102
+ You'll be prompted for:
103
+ - Command name
104
+ - Command to save
105
+ - Working directory (defaults to current directory)
106
+
107
+ ### List All Saved Commands
108
+
109
+ View all your saved commands:
110
+
111
+ ```bash
112
+ aliasmate list
113
+ # or
114
+ aliasmate ls
115
+ ```
116
+
117
+ **Output:**
118
+ ```
119
+ Saved commands (3):
120
+
121
+ build
122
+ Command: npm run build
123
+ Directory: /path/to/project
124
+
125
+ deploy
126
+ Command: ./deploy.sh
127
+ Directory: /path/to/scripts
128
+
129
+ test
130
+ Command: pytest tests/
131
+ Directory: /path/to/python-project
132
+ ```
133
+
134
+ ### Edit a Saved Command
135
+
136
+ Modify an existing command:
137
+
138
+ ```bash
139
+ aliasmate edit <name>
140
+ ```
141
+
142
+ Opens an interactive prompt to edit the command and directory.
143
+
144
+ ### Delete a Saved Command
145
+
146
+ Remove a command you no longer need:
147
+
148
+ ```bash
149
+ aliasmate delete <name>
150
+ # or
151
+ aliasmate rm <name>
152
+ ```
153
+
154
+ ### Export Commands
155
+
156
+ Backup your commands to a JSON file:
157
+
158
+ ```bash
159
+ aliasmate export commands.json
160
+ ```
161
+
162
+ ### Import Commands
163
+
164
+ Restore commands from a JSON file:
165
+
166
+ ```bash
167
+ aliasmate import commands.json
168
+ ```
169
+
170
+ If there are name conflicts, you'll be prompted to:
171
+ - Overwrite existing commands
172
+ - Skip imported commands
173
+ - Rename imported commands
174
+
175
+ ### View Config Location
176
+
177
+ See where your commands are stored:
178
+
179
+ ```bash
180
+ aliasmate config
181
+ ```
182
+
183
+ ## Configuration
184
+
185
+ Commands are stored in:
186
+ - **Linux/macOS**: `~/.config/aliasmate/config.json`
187
+ - **Windows**: `%USERPROFILE%\.config\aliasmate\config.json`
188
+
189
+ ## Command Reference
190
+
191
+ | Command | Aliases | Description |
192
+ |---------|---------|-------------|
193
+ | `aliasmate prev <name>` | - | Save the previous command from shell history |
194
+ | `aliasmate run <name> [path]` | - | Run a saved command (optionally in a different directory) |
195
+ | `aliasmate save` | - | Interactively save a new command |
196
+ | `aliasmate list` | `ls` | List all saved commands |
197
+ | `aliasmate edit <name>` | - | Edit a saved command |
198
+ | `aliasmate delete <name>` | `rm` | Delete a saved command |
199
+ | `aliasmate export <file>` | - | Export commands to a JSON file |
200
+ | `aliasmate import <file>` | - | Import commands from a JSON file |
201
+ | `aliasmate config` | - | Show config file location |
202
+
203
+ ## Examples
204
+
205
+ ### Common Workflows
206
+
207
+ **1. Save and reuse a build command:**
208
+ ```bash
209
+ cd /my/project
210
+ npm run build -- --production
211
+ aliasmate prev build-prod
212
+ # Later, from anywhere:
213
+ aliasmate run build-prod
214
+ ```
215
+
216
+ **2. Save a deployment script:**
217
+ ```bash
218
+ aliasmate save
219
+ # Name: deploy
220
+ # Command: ./scripts/deploy.sh --env production
221
+ # Directory: /path/to/project
222
+ ```
223
+
224
+ **3. Run a command in a different directory:**
225
+ ```bash
226
+ aliasmate run test /path/to/different/project
227
+ ```
228
+
229
+ **4. Backup your commands:**
230
+ ```bash
231
+ aliasmate export ~/backups/aliasmate-$(date +%Y%m%d).json
232
+ ```
233
+
234
+ **5. Share commands with your team:**
235
+ ```bash
236
+ # Person A
237
+ aliasmate export team-commands.json
238
+
239
+ # Person B
240
+ aliasmate import team-commands.json
241
+ ```
242
+
243
+ ## Tips
244
+
245
+ - Use descriptive names for your commands (e.g., `build-prod`, `test-unit`, `deploy-staging`)
246
+ - Regularly export your commands as backup
247
+ - The `prev` command is great for saving complex commands you just figured out
248
+ - Use path override to run the same command in multiple projects
249
+
250
+ ## Troubleshooting
251
+
252
+ ### "Could not retrieve previous command from history"
253
+
254
+ This happens when shell history is disabled or cannot be accessed. Make sure:
255
+ - Your shell history is enabled
256
+ - You have a history file (`~/.zsh_history` for zsh, `~/.bash_history` for bash)
257
+
258
+ ### Commands not executing properly
259
+
260
+ - Verify the saved directory exists: `aliasmate list`
261
+ - Check if the command requires environment variables or specific shell configuration
262
+ - Try running the command manually in the saved directory first
263
+
264
+ ## Development
265
+
266
+ To work on AliasMate locally:
267
+
268
+ ```bash
269
+ # Clone the repository
270
+ git clone https://github.com/aliasmate/aliasmate.git
271
+ cd aliasmate
272
+
273
+ # Install dependencies
274
+ npm install
275
+
276
+ # Link for local development
277
+ npm link
278
+
279
+ # Test the CLI
280
+ aliasmate --help
281
+ ```
282
+
283
+ ## License
284
+
285
+ MIT
286
+
287
+ ## Contributing
288
+
289
+ Contributions are welcome! Please feel free to submit a Pull Request.
290
+
291
+ ## Author
292
+
293
+ Created with ❤️ for developers who love productivity tools.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const commander_1 = require("commander");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const prev_1 = require("./commands/prev");
10
+ const run_1 = require("./commands/run");
11
+ const save_1 = require("./commands/save");
12
+ const list_1 = require("./commands/list");
13
+ const delete_1 = require("./commands/delete");
14
+ const edit_1 = require("./commands/edit");
15
+ const export_1 = require("./commands/export");
16
+ const import_1 = require("./commands/import");
17
+ const storage_1 = require("./storage");
18
+ const program = new commander_1.Command();
19
+ program
20
+ .name('aliasmate')
21
+ .description('A CLI utility to save, manage, and re-run shell commands with their working directories')
22
+ .version('1.0.0');
23
+ // prev command - save previous command from history
24
+ program
25
+ .command('prev <name>')
26
+ .description('Save the previous command from shell history')
27
+ .action((name, options) => {
28
+ (0, prev_1.prevCommand)(name, options, process.cwd());
29
+ });
30
+ // run command - execute a saved command
31
+ program
32
+ .command('run <name> [path]')
33
+ .description('Run a saved command (optionally override the working directory)')
34
+ .action((name, path, options) => {
35
+ (0, run_1.runCommand)(name, path, options);
36
+ });
37
+ // save command - interactively save a new command
38
+ program
39
+ .command('save')
40
+ .description('Interactively save a new command')
41
+ .action((options) => {
42
+ (0, save_1.saveCommand)(options, process.cwd());
43
+ });
44
+ // list commands
45
+ program
46
+ .command('list')
47
+ .alias('ls')
48
+ .description('List all saved commands')
49
+ .action(() => {
50
+ (0, list_1.listCommand)();
51
+ });
52
+ // delete command
53
+ program
54
+ .command('delete <name>')
55
+ .alias('rm')
56
+ .description('Delete a saved command')
57
+ .action((name) => {
58
+ (0, delete_1.deleteCommand)(name);
59
+ });
60
+ // edit command
61
+ program
62
+ .command('edit <name>')
63
+ .description('Edit a saved command')
64
+ .action((name) => {
65
+ (0, edit_1.editCommand)(name);
66
+ });
67
+ // export commands
68
+ program
69
+ .command('export <file>')
70
+ .description('Export all saved commands to a JSON file')
71
+ .action((file) => {
72
+ (0, export_1.exportCommand)(file);
73
+ });
74
+ // import commands
75
+ program
76
+ .command('import <file>')
77
+ .description('Import commands from a JSON file')
78
+ .action((file) => {
79
+ (0, import_1.importCommand)(file);
80
+ });
81
+ // config command - show config location
82
+ program
83
+ .command('config')
84
+ .description('Show the location of the config file')
85
+ .action(() => {
86
+ console.log(chalk_1.default.blue('Config file location:'));
87
+ console.log(chalk_1.default.gray((0, storage_1.getConfigPath)()));
88
+ });
89
+ // Handle unknown commands
90
+ program.on('command:*', () => {
91
+ console.error(chalk_1.default.red('Invalid command: %s'), program.args.join(' '));
92
+ console.log(chalk_1.default.yellow('See --help for a list of available commands.'));
93
+ process.exit(1);
94
+ });
95
+ // Parse arguments
96
+ program.parse(process.argv);
97
+ // Show help if no arguments provided
98
+ if (!process.argv.slice(2).length) {
99
+ program.outputHelp();
100
+ }
101
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAo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AC3B,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,kBAAkB;AAClB,OAAO,CAAC,KAAK,CAAC,OAAO,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"}
@@ -0,0 +1,2 @@
1
+ export declare function deleteCommand(name: string): void;
2
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAuBhD"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deleteCommand = deleteCommand;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const storage_1 = require("../storage");
9
+ function deleteCommand(name) {
10
+ try {
11
+ // Check if alias exists
12
+ const alias = (0, storage_1.getAlias)(name);
13
+ if (!alias) {
14
+ console.error(chalk_1.default.red(`Error: No saved command found with name "${name}"`));
15
+ console.log(chalk_1.default.yellow('Use "aliasmate list" to see all saved commands'));
16
+ process.exit(1);
17
+ }
18
+ // Delete the alias
19
+ const success = (0, storage_1.deleteAlias)(name);
20
+ if (success) {
21
+ console.log(chalk_1.default.green(`✓ Deleted command "${name}"`));
22
+ }
23
+ else {
24
+ console.error(chalk_1.default.red('Error: Could not delete command'));
25
+ process.exit(1);
26
+ }
27
+ }
28
+ catch (error) {
29
+ console.error(chalk_1.default.red('Error:'), error.message);
30
+ process.exit(1);
31
+ }
32
+ }
33
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../src/commands/delete.ts"],"names":[],"mappings":";;;;;AAGA,sCAuBC;AA1BD,kDAA0B;AAC1B,wCAAmD;AAEnD,SAAgB,aAAa,CAAC,IAAY;IACxC,IAAI,CAAC;QACH,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,4CAA4C,IAAI,GAAG,CAAC,CAAC,CAAC;YAC9E,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,mBAAmB;QACnB,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,CAAC;QAElC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,sBAAsB,IAAI,GAAG,CAAC,CAAC,CAAC;QAC1D,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC,CAAC;YAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function editCommand(name: string): Promise<void>;
2
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/commands/edit.ts"],"names":[],"mappings":"AAIA,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4D7D"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.editCommand = editCommand;
7
+ const inquirer_1 = __importDefault(require("inquirer"));
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const storage_1 = require("../storage");
10
+ async function editCommand(name) {
11
+ try {
12
+ // Get the existing alias
13
+ const alias = (0, storage_1.getAlias)(name);
14
+ if (!alias) {
15
+ console.error(chalk_1.default.red(`Error: No saved command found with name "${name}"`));
16
+ console.log(chalk_1.default.yellow('Use "aliasmate list" to see all saved commands'));
17
+ process.exit(1);
18
+ }
19
+ console.log(chalk_1.default.blue(`Editing command: ${name}\n`));
20
+ // Prompt for new values
21
+ const answers = await inquirer_1.default.prompt([
22
+ {
23
+ type: 'input',
24
+ name: 'command',
25
+ message: 'Command:',
26
+ default: alias.command,
27
+ validate: (input) => {
28
+ if (!input.trim()) {
29
+ return 'Command cannot be empty';
30
+ }
31
+ return true;
32
+ }
33
+ },
34
+ {
35
+ type: 'input',
36
+ name: 'directory',
37
+ message: 'Working directory:',
38
+ default: alias.directory
39
+ }
40
+ ]);
41
+ // Check if anything changed
42
+ if (answers.command === alias.command && answers.directory === alias.directory) {
43
+ console.log(chalk_1.default.yellow('No changes made'));
44
+ return;
45
+ }
46
+ // Update the alias
47
+ const success = (0, storage_1.setAlias)(name, answers.command, answers.directory);
48
+ if (success) {
49
+ console.log(chalk_1.default.green(`✓ Updated command "${name}"`));
50
+ console.log(chalk_1.default.gray(` Command: ${answers.command}`));
51
+ console.log(chalk_1.default.gray(` Directory: ${answers.directory}`));
52
+ }
53
+ else {
54
+ console.error(chalk_1.default.red('Error: Could not update command'));
55
+ process.exit(1);
56
+ }
57
+ }
58
+ catch (error) {
59
+ if (error.isTtyError) {
60
+ console.error(chalk_1.default.red('Error: Interactive prompt not supported in this environment'));
61
+ }
62
+ else {
63
+ console.error(chalk_1.default.red('Error:'), error.message);
64
+ }
65
+ process.exit(1);
66
+ }
67
+ }
68
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../src/commands/edit.ts"],"names":[],"mappings":";;;;;AAIA,kCA4DC;AAhED,wDAAgC;AAChC,kDAA0B;AAC1B,wCAAgD;AAEzC,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,IAAI,CAAC;QACH,yBAAyB;QACzB,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;QAE7B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,4CAA4C,IAAI,GAAG,CAAC,CAAC,CAAC;YAC9E,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,gDAAgD,CAAC,CAAC,CAAC;YAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,CAAC,CAAC;QAEtD,wBAAwB;QACxB,MAAM,OAAO,GAAG,MAAM,kBAAQ,CAAC,MAAM,CAAC;YACpC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,SA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C;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function exportCommand(filePath: string): void;
2
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CA+BpD"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.exportCommand = exportCommand;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const chalk_1 = __importDefault(require("chalk"));
43
+ const storage_1 = require("../storage");
44
+ function exportCommand(filePath) {
45
+ try {
46
+ const aliases = (0, storage_1.loadAliases)();
47
+ const names = Object.keys(aliases);
48
+ if (names.length === 0) {
49
+ console.log(chalk_1.default.yellow('No saved commands to export.'));
50
+ return;
51
+ }
52
+ // Resolve the file path
53
+ const resolvedPath = path.resolve(filePath);
54
+ // Export as JSON
55
+ const exportData = {
56
+ exportedAt: new Date().toISOString(),
57
+ version: '1.0',
58
+ aliases: aliases
59
+ };
60
+ try {
61
+ fs.writeFileSync(resolvedPath, JSON.stringify(exportData, null, 2), 'utf8');
62
+ console.log(chalk_1.default.green(`✓ Exported ${names.length} command(s) to ${resolvedPath}`));
63
+ }
64
+ catch (writeError) {
65
+ console.error(chalk_1.default.red('Error: Could not write to file'), writeError.message);
66
+ process.exit(1);
67
+ }
68
+ }
69
+ catch (error) {
70
+ console.error(chalk_1.default.red('Error:'), error.message);
71
+ process.exit(1);
72
+ }
73
+ }
74
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,sCA+BC;AApCD,u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