aliasmate 1.6.1 → 2.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 (203) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +61 -876
  3. package/dist/cli/completion.d.ts +5 -0
  4. package/dist/cli/completion.d.ts.map +1 -0
  5. package/dist/cli/completion.js +144 -0
  6. package/dist/cli/completion.js.map +1 -0
  7. package/dist/cli/manage.d.ts +20 -0
  8. package/dist/cli/manage.d.ts.map +1 -0
  9. package/dist/cli/manage.js +213 -0
  10. package/dist/cli/manage.js.map +1 -0
  11. package/dist/cli/run.d.ts +6 -0
  12. package/dist/cli/run.d.ts.map +1 -0
  13. package/dist/cli/run.js +46 -0
  14. package/dist/cli/run.js.map +1 -0
  15. package/dist/cli/save.d.ts +9 -0
  16. package/dist/cli/save.d.ts.map +1 -0
  17. package/dist/cli/save.js +52 -0
  18. package/dist/cli/save.js.map +1 -0
  19. package/dist/cli/transfer.d.ts +5 -0
  20. package/dist/cli/transfer.d.ts.map +1 -0
  21. package/dist/cli/transfer.js +118 -0
  22. package/dist/cli/transfer.js.map +1 -0
  23. package/dist/core/commands.d.ts +27 -0
  24. package/dist/core/commands.d.ts.map +1 -0
  25. package/dist/core/commands.js +194 -0
  26. package/dist/core/commands.js.map +1 -0
  27. package/dist/core/env.d.ts +9 -0
  28. package/dist/core/env.d.ts.map +1 -0
  29. package/dist/core/env.js +45 -0
  30. package/dist/core/env.js.map +1 -0
  31. package/dist/core/executor.d.ts +7 -0
  32. package/dist/core/executor.d.ts.map +1 -0
  33. package/dist/{utils → core}/executor.js +10 -46
  34. package/dist/core/executor.js.map +1 -0
  35. package/dist/core/history.d.ts +11 -0
  36. package/dist/core/history.d.ts.map +1 -0
  37. package/dist/core/history.js +117 -0
  38. package/dist/core/history.js.map +1 -0
  39. package/dist/core/recent.d.ts +14 -0
  40. package/dist/core/recent.d.ts.map +1 -0
  41. package/dist/core/recent.js +54 -0
  42. package/dist/core/recent.js.map +1 -0
  43. package/dist/core/runner.d.ts +13 -0
  44. package/dist/core/runner.d.ts.map +1 -0
  45. package/dist/core/runner.js +83 -0
  46. package/dist/core/runner.js.map +1 -0
  47. package/dist/core/store.d.ts +29 -0
  48. package/dist/core/store.d.ts.map +1 -0
  49. package/dist/core/store.js +131 -0
  50. package/dist/core/store.js.map +1 -0
  51. package/dist/core/types.d.ts +29 -0
  52. package/dist/core/types.d.ts.map +1 -0
  53. package/dist/core/types.js +3 -0
  54. package/dist/core/types.js.map +1 -0
  55. package/dist/core/validate.d.ts +6 -0
  56. package/dist/core/validate.d.ts.map +1 -0
  57. package/dist/core/validate.js +139 -0
  58. package/dist/core/validate.js.map +1 -0
  59. package/dist/index.d.ts +3 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +169 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/ui/format.d.ts +16 -0
  64. package/dist/ui/format.d.ts.map +1 -0
  65. package/dist/ui/format.js +112 -0
  66. package/dist/ui/format.js.map +1 -0
  67. package/dist/ui/interactive.d.ts +6 -0
  68. package/dist/ui/interactive.d.ts.map +1 -0
  69. package/dist/ui/interactive.js +147 -0
  70. package/dist/ui/interactive.js.map +1 -0
  71. package/dist/ui/onboarding.d.ts +3 -0
  72. package/dist/ui/onboarding.d.ts.map +1 -0
  73. package/dist/ui/onboarding.js +82 -0
  74. package/dist/ui/onboarding.js.map +1 -0
  75. package/dist/ui/prompts.d.ts +14 -0
  76. package/dist/ui/prompts.d.ts.map +1 -0
  77. package/dist/ui/prompts.js +96 -0
  78. package/dist/ui/prompts.js.map +1 -0
  79. package/dist/ui/theme.d.ts +28 -0
  80. package/dist/ui/theme.d.ts.map +1 -0
  81. package/dist/ui/theme.js +43 -0
  82. package/dist/ui/theme.js.map +1 -0
  83. package/package.json +4 -5
  84. package/dist/cli.d.ts +0 -3
  85. package/dist/cli.d.ts.map +0 -1
  86. package/dist/cli.js +0 -252
  87. package/dist/cli.js.map +0 -1
  88. package/dist/commands/alias.d.ts +0 -30
  89. package/dist/commands/alias.d.ts.map +0 -1
  90. package/dist/commands/alias.js +0 -213
  91. package/dist/commands/alias.js.map +0 -1
  92. package/dist/commands/changelog.d.ts +0 -9
  93. package/dist/commands/changelog.d.ts.map +0 -1
  94. package/dist/commands/changelog.js +0 -72
  95. package/dist/commands/changelog.js.map +0 -1
  96. package/dist/commands/completion.d.ts +0 -17
  97. package/dist/commands/completion.d.ts.map +0 -1
  98. package/dist/commands/completion.js +0 -363
  99. package/dist/commands/completion.js.map +0 -1
  100. package/dist/commands/delete.d.ts +0 -14
  101. package/dist/commands/delete.d.ts.map +0 -1
  102. package/dist/commands/delete.js +0 -54
  103. package/dist/commands/delete.js.map +0 -1
  104. package/dist/commands/edit.d.ts +0 -16
  105. package/dist/commands/edit.d.ts.map +0 -1
  106. package/dist/commands/edit.js +0 -231
  107. package/dist/commands/edit.js.map +0 -1
  108. package/dist/commands/export.d.ts +0 -23
  109. package/dist/commands/export.d.ts.map +0 -1
  110. package/dist/commands/export.js +0 -122
  111. package/dist/commands/export.js.map +0 -1
  112. package/dist/commands/import.d.ts +0 -23
  113. package/dist/commands/import.d.ts.map +0 -1
  114. package/dist/commands/import.js +0 -235
  115. package/dist/commands/import.js.map +0 -1
  116. package/dist/commands/list.d.ts +0 -25
  117. package/dist/commands/list.d.ts.map +0 -1
  118. package/dist/commands/list.js +0 -58
  119. package/dist/commands/list.js.map +0 -1
  120. package/dist/commands/prev.d.ts +0 -15
  121. package/dist/commands/prev.d.ts.map +0 -1
  122. package/dist/commands/prev.js +0 -138
  123. package/dist/commands/prev.js.map +0 -1
  124. package/dist/commands/recent.d.ts +0 -24
  125. package/dist/commands/recent.d.ts.map +0 -1
  126. package/dist/commands/recent.js +0 -132
  127. package/dist/commands/recent.js.map +0 -1
  128. package/dist/commands/run.d.ts +0 -22
  129. package/dist/commands/run.d.ts.map +0 -1
  130. package/dist/commands/run.js +0 -217
  131. package/dist/commands/run.js.map +0 -1
  132. package/dist/commands/save.d.ts +0 -17
  133. package/dist/commands/save.d.ts.map +0 -1
  134. package/dist/commands/save.js +0 -232
  135. package/dist/commands/save.js.map +0 -1
  136. package/dist/commands/search.d.ts +0 -19
  137. package/dist/commands/search.d.ts.map +0 -1
  138. package/dist/commands/search.js +0 -113
  139. package/dist/commands/search.js.map +0 -1
  140. package/dist/commands/validate.d.ts +0 -10
  141. package/dist/commands/validate.d.ts.map +0 -1
  142. package/dist/commands/validate.js +0 -162
  143. package/dist/commands/validate.js.map +0 -1
  144. package/dist/storage/index.d.ts +0 -117
  145. package/dist/storage/index.d.ts.map +0 -1
  146. package/dist/storage/index.js +0 -262
  147. package/dist/storage/index.js.map +0 -1
  148. package/dist/utils/changelog.d.ts +0 -41
  149. package/dist/utils/changelog.d.ts.map +0 -1
  150. package/dist/utils/changelog.js +0 -192
  151. package/dist/utils/changelog.js.map +0 -1
  152. package/dist/utils/constants.d.ts +0 -48
  153. package/dist/utils/constants.d.ts.map +0 -1
  154. package/dist/utils/constants.js +0 -51
  155. package/dist/utils/constants.js.map +0 -1
  156. package/dist/utils/env.d.ts +0 -64
  157. package/dist/utils/env.d.ts.map +0 -1
  158. package/dist/utils/env.js +0 -199
  159. package/dist/utils/env.js.map +0 -1
  160. package/dist/utils/errors.d.ts +0 -30
  161. package/dist/utils/errors.d.ts.map +0 -1
  162. package/dist/utils/errors.js +0 -62
  163. package/dist/utils/errors.js.map +0 -1
  164. package/dist/utils/executor.d.ts +0 -33
  165. package/dist/utils/executor.d.ts.map +0 -1
  166. package/dist/utils/executor.js.map +0 -1
  167. package/dist/utils/formatters.d.ts +0 -30
  168. package/dist/utils/formatters.d.ts.map +0 -1
  169. package/dist/utils/formatters.js +0 -188
  170. package/dist/utils/formatters.js.map +0 -1
  171. package/dist/utils/history.d.ts +0 -37
  172. package/dist/utils/history.d.ts.map +0 -1
  173. package/dist/utils/history.js +0 -179
  174. package/dist/utils/history.js.map +0 -1
  175. package/dist/utils/llm-generator.d.ts +0 -21
  176. package/dist/utils/llm-generator.d.ts.map +0 -1
  177. package/dist/utils/llm-generator.js +0 -915
  178. package/dist/utils/llm-generator.js.map +0 -1
  179. package/dist/utils/onboarding.d.ts +0 -10
  180. package/dist/utils/onboarding.d.ts.map +0 -1
  181. package/dist/utils/onboarding.js +0 -316
  182. package/dist/utils/onboarding.js.map +0 -1
  183. package/dist/utils/paths.d.ts +0 -44
  184. package/dist/utils/paths.d.ts.map +0 -1
  185. package/dist/utils/paths.js +0 -115
  186. package/dist/utils/paths.js.map +0 -1
  187. package/dist/utils/prompts.d.ts +0 -66
  188. package/dist/utils/prompts.d.ts.map +0 -1
  189. package/dist/utils/prompts.js +0 -51
  190. package/dist/utils/prompts.js.map +0 -1
  191. package/dist/utils/recent.d.ts +0 -55
  192. package/dist/utils/recent.d.ts.map +0 -1
  193. package/dist/utils/recent.js +0 -102
  194. package/dist/utils/recent.js.map +0 -1
  195. package/dist/utils/validator.d.ts +0 -56
  196. package/dist/utils/validator.d.ts.map +0 -1
  197. package/dist/utils/validator.js +0 -413
  198. package/dist/utils/validator.js.map +0 -1
  199. package/dist/utils/version-checker.d.ts +0 -29
  200. package/dist/utils/version-checker.d.ts.map +0 -1
  201. package/dist/utils/version-checker.js +0 -191
  202. package/dist/utils/version-checker.js.map +0 -1
  203. package/whats-new.json +0 -202
@@ -1,915 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.generateLLMContent = generateLLMContent;
37
- exports.createLLMFile = createLLMFile;
38
- exports.getDefaultLLMCommand = getDefaultLLMCommand;
39
- const fs = __importStar(require("fs"));
40
- const path = __importStar(require("path"));
41
- const constants_1 = require("./constants");
42
- /**
43
- * Generate LLM.txt content with all AliasMate features and documentation
44
- */
45
- function generateLLMContent() {
46
- return `# AliasMate - Terminal Command Management CLI
47
-
48
- Version: ${constants_1.APP_VERSION}
49
- Official Tool: ${constants_1.APP_NAME}
50
-
51
- ## Overview
52
-
53
- AliasMate is a powerful CLI utility that saves, manages, and re-runs shell commands with their working directories. It helps developers save time, reduce errors, and boost productivity by eliminating the need to retype complex commands or remember their exact locations.
54
-
55
- ## Core Capabilities
56
-
57
- ### 1. Command Storage
58
- - Save any shell command with a memorable name
59
- - Store the working directory where the command should execute
60
- - Preserve metadata (creation date, last modified)
61
- - Support for complex multi-line commands and scripts
62
-
63
- ### 2. Command Execution
64
- - Run saved commands from anywhere in the filesystem
65
- - Automatic directory switching to the saved location
66
- - Option to override execution directory (use current or saved path)
67
- - Support for both absolute and relative path overrides
68
- - Environment variable capture and restoration
69
- - Dry-run mode to preview commands before execution
70
- - Recent command tracking with @N syntax (@0 = most recent)
71
- - Alias resolution for keyboard-friendly shortcuts
72
-
73
- ### 3. Command Management
74
- - List all saved commands with full details
75
- - Search commands by name, command text, or directory
76
- - Edit existing commands interactively
77
- - Delete unwanted commands
78
- - Export/import commands for backup and team sharing
79
- - View changelog and version history
80
- - Create aliases for frequently used commands
81
- - Track recent command executions
82
- - Validate commands before saving
83
- - Multiple output formats (JSON, YAML, table, compact)
84
-
85
- ## Available Commands
86
-
87
- ### aliasmate prev <name>
88
- Save the previous command from shell history.
89
- - Automatically captures the last executed command
90
- - Saves current working directory
91
- - Optionally captures environment variables
92
- - Example: \`aliasmate prev build\`
93
-
94
- ### aliasmate run <name> [path]
95
- Execute a saved command.
96
- - Runs in saved directory by default
97
- - Optional path parameter to override directory
98
- - Supports path mode (saved vs current directory)
99
- - Restores saved environment variables
100
- - Warns about environment variable differences
101
- - Dry-run mode: \`--dry-run\` to preview without executing
102
- - Verbose mode: \`--verbose\` for detailed dry-run output
103
- - @N syntax: \`aliasmate run @0\` to run most recent command
104
- - Alias support: Automatically resolves command aliases
105
- - Examples:
106
- - \`aliasmate run build\`
107
- - \`aliasmate run build .\`
108
- - \`aliasmate run build --dry-run\`
109
- - \`aliasmate run @0\` (most recent command)
110
- - \`aliasmate run @1\` (second most recent)
111
-
112
- ### aliasmate save
113
- Interactively create a new saved command.
114
- - Prompts for command name
115
- - Prompts for command to execute
116
- - Prompts for working directory
117
- - Prompts for path mode preference
118
- - Optionally capture environment variables
119
- - Optional validation: \`--no-validate\` to skip validation
120
- - Example: \`aliasmate save\` or \`aliasmate save --no-validate\`
121
-
122
- ### aliasmate list (alias: ls)
123
- Display all saved commands.
124
- - Shows command name, actual command, and directory
125
- - Displays path mode for each command
126
- - Color-coded output for readability
127
- - Multiple format options: \`--format <type>\`
128
- - \`table\` - Default human-readable table
129
- - \`json\` - Machine-readable JSON
130
- - \`yaml\` - YAML format
131
- - \`compact\` - One-line per command
132
- - Examples:
133
- - \`aliasmate list\`
134
- - \`aliasmate list --format json\`
135
- - \`aliasmate list --format yaml\`
136
-
137
- ### aliasmate search <query> (alias: find)
138
- Search for commands by keyword.
139
- - Searches in command name, command text, and directory path
140
- - Case-insensitive matching
141
- - Example: \`aliasmate search deploy\`
142
-
143
- ### aliasmate edit <name>
144
- Edit an existing saved command.
145
- - Modify command, directory, or path mode
146
- - Manage environment variables
147
- - Optional validation bypass: \`--no-validate\`
148
- - Examples:
149
- - \`aliasmate edit build\`
150
- - \`aliasmate edit build --no-validate\`
151
-
152
- ### aliasmate delete <name> (alias: rm)
153
- Remove a saved command.
154
- - Permanently deletes the command
155
- - Example: \`aliasmate delete old-build\`
156
-
157
- ### aliasmate export <file>
158
- Export all commands to a file.
159
- - Backup your commands
160
- - Share with team members
161
- - Includes environment variables (sensitive ones are masked)
162
- - Multiple format options: \`--format <type>\`
163
- - \`json\` - JSON format (default)
164
- - \`yaml\` - YAML format
165
- - Examples:
166
- - \`aliasmate export my-commands.json\`
167
- - \`aliasmate export my-commands.yaml --format yaml\`
168
-
169
- ### aliasmate import <file>
170
- Import commands from a JSON file.
171
- - Restore from backup
172
- - Load teammate's commands
173
- - Prompts before overwriting existing commands
174
- - Automatic backup created before import
175
- - Example: \`aliasmate import my-commands.json\`
176
-
177
- ### aliasmate changelog (alias: changes)
178
- View version changelog and release notes.
179
- - View current version changes
180
- - View specific version changes
181
- - View cumulative changes between versions
182
- - Examples:
183
- - \`aliasmate changelog\` - Current version
184
- - \`aliasmate changelog --ver 1.3.0\` - Specific version
185
- - \`aliasmate changelog --from 1.2.0\` - All changes since 1.2.0
186
-
187
- ### aliasmate config
188
- Show configuration details.
189
- - Display config directory and file path
190
- - Show number of saved commands
191
- - Example: \`aliasmate config\`
192
-
193
- ### aliasmate alias <shortname> <commandname>
194
- Create or update command aliases.
195
- - Create keyboard-friendly shortcuts
196
- - Validates against reserved command names
197
- - Automatic target command validation
198
- - Examples:
199
- - \`aliasmate alias b build\` - Create alias
200
- - \`aliasmate alias --list\` - List all aliases
201
- - \`aliasmate alias --remove b\` - Remove alias
202
-
203
- ### aliasmate recent
204
- View and manage recently executed commands.
205
- - Shows command execution history with timestamps
206
- - Displays execution count for each command
207
- - Time-ago formatting (e.g., "2 minutes ago")
208
- - Limit results: \`--limit <N>\`
209
- - Clear history: \`--clear\`
210
- - Examples:
211
- - \`aliasmate recent\` - Show recent commands
212
- - \`aliasmate recent --limit 10\` - Show last 10
213
- - \`aliasmate recent --clear\` - Clear history
214
-
215
- ### aliasmate validate <name>
216
- Validate commands and their context.
217
- - Checks command existence in PATH
218
- - Verifies directory exists and is accessible
219
- - Validates shell syntax (quotes, brackets, pipes)
220
- - Validates environment variable patterns
221
- - Batch validation: \`--all\` flag
222
- - Examples:
223
- - \`aliasmate validate build\` - Validate one command
224
- - \`aliasmate validate --all\` - Validate all commands
225
-
226
- ### aliasmate completion <shell>
227
- Generate shell completion scripts.
228
- - Supports bash, zsh, and fish shells
229
- - Dynamic completion for command names
230
- - Completes flags and options
231
- - File path completion for import/export
232
- - Examples:
233
- - \`aliasmate completion bash\` - Generate bash completion
234
- - \`aliasmate completion zsh\` - Generate zsh completion
235
- - \`aliasmate completion fish\` - Generate fish completion
236
-
237
- Installation:
238
- - Bash: \`source <(aliasmate completion bash)\`
239
- - Zsh: \`source <(aliasmate completion zsh)\`
240
- - Fish: \`aliasmate completion fish > ~/.config/fish/completions/aliasmate.fish\`
241
-
242
- ### aliasmate llm
243
- Generate this llm.txt file (default command).
244
- - Creates comprehensive documentation
245
- - CEnvironment Variables Feature
246
-
247
- AliasMate can capture and restore environment variables along with your commands:
248
-
249
- ### Automatic Capture
250
- - When saving commands with \`prev\` or \`save\`, optionally capture environment variables
251
- - Only user-defined variables are captured (system variables excluded)
252
- - Sensitive variables (API keys, tokens, passwords) are automatically detected
253
-
254
- ### Security Features
255
- - Sensitive variables are masked in exports (e.g., \`API_KEY=abc***xy\`)
256
- - System variables (PATH, HOME, etc.) are filtered out
257
- - Onenv\`: Optional object containing environment variables
258
- - \`createdAt\`: ISO 8601 timestamp
259
- - \`updatedAt\`: ISO 8601 timestamp
260
-
261
- ## Version History and Changelog
262
-
263
- AliasMate maintains a comprehensive changelog accessible via CLI:
264
-
265
- ### Viewing Changes
266
- - \`aliasmate changelog\` - View current version changes
267
- - \`aliasmate changelog --ver 1.3.0\` - View specific version
268
- - \`aliasmate changelog --from 1.2.0 --to 1.4.0\` - Cumulative changes
269
- - \`aliasmate changelog --from 1.2.0\` - All changes since a version
270
-
271
- ### Upgrade Notifications
272
- - Automatic upgrade detection on first run after update
273
- - Shows cumulative changes since your last version
274
- - Highlights key new features and improvements
275
- - Links to full changelog documentation
276
-
277
- ### Version Information
278
- - Current version: \`aliasmate --version\`
279
- - Semantic versioning (major.minor.patch)
280
- - Regular updates with new features and bug fixesa is detected
281
-
282
- ### Environment Restoration
283
- - Saved environment variables are restored when running commands
284
- - Variables are merged with current environment
285
- - Current environment takes precedence over saved values
286
- - Warnings shown if variables differ from saved values
287
-
288
- ### Managing Environment Variables
289
- - Edit command to update environment variables
290
- - Select specific variables to keep or remove
291
- - Clear all environment variables from a command
292
- - View environment variables in command listings
293
-
294
- ### Use Cases
295
- - Development with specific environment variables (\`NODE_ENV\`, \`DEBUG\`)
296
- - API testing with tokens and endpoints
297
- - Multi-environment deployments (dev, staging, prod)
298
- - Consistent tool configurations across team members
299
-
300
- ## an be shared with AI assistants
301
- - Example: \`aliasmate run llm\`
302
-
303
- ## Path Mode Feature
304
-
305
- Each saved command can have a path mode that determines where it executes:
306
-
307
- ### Saved Directory Mode (default)
308
- - Command always runs in the directory where it was saved
309
- - Useful for project-specific commands
310
- - Example: Build scripts that must run in the project root
311
-
312
- ### Current Directory Mode
313
- - Command runs in your current working directory
314
- - Useful for general-purpose utilities
315
- - Example: Git commands that work in any repository
316
-
317
- You can choose the path mode when saving or editing a command.
318
-
319
- ## Command Aliases Feature
320
-
321
- Create short aliases for frequently used commands to speed up your workflow:
322
-
323
- ### Creating Aliases
324
- - \`aliasmate alias <short> <command>\` - Create an alias
325
- - Example: \`aliasmate alias b build\` creates shortcut "b" for "build"
326
-
327
- ### Using Aliases
328
- - Run aliased commands: \`aliasmate run b\` (runs the "build" command)
329
- - Aliases are resolved automatically before execution
330
- - Shows both alias and original command name when running
331
-
332
- ### Managing Aliases
333
- - List all: \`aliasmate alias --list\`
334
- - Remove: \`aliasmate alias --remove <alias>\`
335
- - Update: Create alias with same name (overwrites with warning)
336
-
337
- ### Validation
338
- - Prevents conflicts with reserved names (save, run, list, etc.)
339
- - Only alphanumeric, dash, and underscore allowed
340
- - Verifies target command exists
341
-
342
- ## Recent Commands Feature
343
-
344
- Track command execution history and quickly re-run recent commands:
345
-
346
- ### Viewing Recent Commands
347
- - \`aliasmate recent\` - Show recent executions
348
- - \`--limit <N>\` - Limit results (e.g., \`aliasmate recent --limit 10\`)
349
- - Shows: command name, last run time, execution count
350
- - Time-ago formatting: "2 minutes ago", "3 hours ago", etc.
351
-
352
- ### Quick Re-execution with @N Syntax
353
- - \`@0\` - Most recent command
354
- - \`@1\` - Second most recent
355
- - \`@2\` - Third most recent
356
- - Example: \`aliasmate run @0\` (re-run last command)
357
-
358
- ### Execution Tracking
359
- - Automatic tracking on every command execution
360
- - Records both successful and failed executions
361
- - Configurable history size (default: 50 entries)
362
- - NOT recorded in dry-run mode
363
-
364
- ### Managing History
365
- - Clear history: \`aliasmate recent --clear\`
366
- - Deduplicated display (unique commands only)
367
- - Stored in metadata.json separately from commands
368
-
369
- ## Dry-Run Mode Feature
370
-
371
- Preview commands before execution to verify what will run:
372
-
373
- ### Basic Dry-Run
374
- \`\`\`bash
375
- aliasmate run build --dry-run
376
- \`\`\`
377
-
378
- Displays:
379
- - Full command to be executed
380
- - Working directory
381
- - Path mode (saved/current/overridden)
382
- - Environment variable count
383
-
384
- ### Verbose Dry-Run
385
- \`\`\`bash
386
- aliasmate run build --dry-run --verbose
387
- \`\`\`
388
-
389
- Shows detailed information:
390
- - All environment variables (with values)
391
- - Sensitive variables are masked (e.g., API_KEY=abc***xyz)
392
- - Complete execution context
393
-
394
- ### Safety Features
395
- - Dangerous command detection (rm -rf, dd, mkfs, format, etc.)
396
- - Color-coded warnings (red for dangers, yellow for cautions)
397
- - No side effects (execution history not recorded)
398
- - Perfect for verifying destructive or long-running commands
399
-
400
- ## Command Validation Feature
401
-
402
- Validate commands when saving to catch errors early:
403
-
404
- ### Automatic Validation
405
- - Enabled by default when using \`save\` or \`edit\` commands
406
- - Can be bypassed with \`--no-validate\` flag
407
-
408
- ### What Gets Validated
409
-
410
- **Command Existence:**
411
- - Checks if command exists in system PATH
412
- - Recognizes shell builtins (cd, echo, export, etc.)
413
- - Validates executable file paths
414
-
415
- **Directory Validation:**
416
- - Verifies directory exists
417
- - Checks read/execute permissions
418
- - Warns if directory not writable
419
-
420
- **Shell Syntax:**
421
- - Unmatched quotes (single, double, backtick)
422
- - Unmatched brackets, braces, parentheses
423
- - Invalid pipe usage
424
- - Invalid operators
425
-
426
- **Environment Variables:**
427
- - Valid variable name patterns
428
- - Undefined variable warnings
429
- - Special character detection
430
-
431
- ### Validation Reports
432
- - **Errors** (red) - Block execution:
433
- - Command not found
434
- - Directory doesn't exist
435
- - Invalid syntax
436
-
437
- - **Warnings** (yellow) - Allow with notice:
438
- - Undefined environment variables
439
- - Shell operators detected
440
- - Non-executable paths
441
-
442
- ### Manual Validation
443
- \`\`\`bash
444
- # Validate single command
445
- aliasmate validate build
446
-
447
- # Batch validate all commands
448
- aliasmate validate --all
449
- \`\`\`
450
-
451
- Shows summary:
452
- - ✓ Commands passed validation
453
- - ⚠ Commands with warnings
454
- - ✗ Commands with errors
455
- - Detailed issue listing
456
-
457
- ## Output Formatting Feature
458
-
459
- Export and display commands in multiple formats for different use cases:
460
-
461
- ### Available Formats
462
-
463
- **Table (default)** - Human-readable display
464
- \`\`\`bash
465
- aliasmate list --format table
466
- \`\`\`
467
- Perfect for terminal viewing, color-coded output
468
-
469
- **JSON** - Machine-readable, CI/CD integration
470
- \`\`\`bash
471
- aliasmate list --format json
472
- aliasmate export commands.json --format json
473
- \`\`\`
474
- Ideal for scripting, automation, parsing
475
-
476
- **YAML** - Human and machine-readable
477
- \`\`\`bash
478
- aliasmate list --format yaml
479
- aliasmate export commands.yaml --format yaml
480
- \`\`\`
481
- Great for configuration management
482
-
483
- **Compact** - One-line per command
484
- \`\`\`bash
485
- aliasmate list --format compact
486
- \`\`\`
487
- Quick scanning, minimal output
488
-
489
- ### What's Included
490
- All formats include:
491
- - Command name and string
492
- - Directory path
493
- - Path mode (saved/current)
494
- - Environment variables
495
- - Timestamps (createdAt, updatedAt)
496
-
497
- ### Use Cases
498
- - **JSON/YAML**: CI/CD pipelines, automation scripts
499
- - **Table**: Daily development workflow
500
- - **Compact**: Quick reference, scripts with limited space
501
- - **Export**: Team sharing (sensitive values masked)
502
-
503
- ## Shell Completion Feature
504
-
505
- Auto-completion support for enhanced productivity:
506
-
507
- ### Supported Shells
508
- - **Bash** - Most Linux distributions
509
- - **Zsh** - macOS default, modern Linux
510
- - **Fish** - Modern shell with enhanced features
511
-
512
- ### What Gets Completed
513
- - Main commands (run, list, save, edit, etc.)
514
- - Your saved command names (dynamic)
515
- - Command flags (--dry-run, --verbose, --format, etc.)
516
- - Format options (json, yaml, table, compact)
517
- - File paths (for import/export)
518
-
519
- ### Installation
520
-
521
- **Bash:**
522
- \`\`\`bash
523
- # Add to ~/.bashrc
524
- source <(aliasmate completion bash)
525
- # Then reload: source ~/.bashrc
526
- \`\`\`
527
-
528
- **Zsh:**
529
- \`\`\`bash
530
- # Add to ~/.zshrc
531
- source <(aliasmate completion zsh)
532
- # Then reload: source ~/.zshrc
533
- \`\`\`
534
-
535
- **Fish:**
536
- \`\`\`bash
537
- aliasmate completion fish > ~/.config/fish/completions/aliasmate.fish
538
- # Fish auto-loads on next shell start
539
- \`\`\`
540
-
541
- ### Usage Examples
542
- - \`aliasmate ru<TAB>\` → completes to "run"
543
- - \`aliasmate run bu<TAB>\` → completes to your "build" command
544
- - \`aliasmate list --fo<TAB>\` → completes to "--format"
545
- - \`aliasmate list --format <TAB>\` → shows json, yaml, table, compact
546
-
547
- ## Configuration
548
-
549
- ### Storage Location
550
- - Config file: \`~/.config/aliasmate/config.json\`
551
- - Metadata file: \`~/.config/aliasmate/metadata.json\`
552
- - Config contains all saved commands
553
- - Metadata contains aliases, execution history, and app state
554
- - JSON format for easy editing if needed
555
-
556
- ### Command Alias Structure
557
- Each command contains:
558
- - \`command\`: The shell command to execute
559
- - \`directory\`: The saved working directory path
560
- - \`pathMode\`: Either "saved" or "current"
561
- - \`env\`: Optional object containing environment variables
562
- - \`createdAt\`: ISO 8601 timestamp
563
- - \`updatedAt\`: ISO 8601 timestamp
564
-
565
- ### Metadata Structure
566
- Contains:
567
- - \`command_aliases\`: Map of alias shortcuts to command names
568
- - \`execution_history\`: Array of recent command executions
569
- - \`recent_config\`: Configuration for recent commands (maxSize, etc.)
570
- - \`onboarding\`: Onboarding state and version tracking
571
-
572
- ## Use Cases
573
-
574
- ### Development Workflows
575
- - Save complex build commands: \`aliasmate prev build-prod\`
576
- - Run test suites: \`aliasmate prev test-integration\`
577
- - # Environment Variable Issues
578
- - Check if saved variables are still valid
579
- - Verify environment variable names and values
580
- - Use \`aliasmate edit <name>\` to update env vars
581
- - Clear environment variables if no longer needed
582
-
583
- ### Version or Changelog Not Showing
584
- - Ensure you have the latest version installed
585
- - Run \`aliasmate changelog\` to view version history
586
- - Check internet connection for upgrade notifications
587
-
588
- ##Deploy applications: \`aliasmate prev deploy-staging\`
589
-
590
- ### Multi-Project Management
591
- - Switch between projects easily
592
- - Run project-specific commands without navigating
593
- - Maintain consistent workflows across projects
594
-
595
- ### Team Collaboration
596
- - Export team workflows: \`aliasmate export team-commands.json\`
597
- - Share best practices and scripts
598
- - Onboard new team members quickly
599
-
600
- ### DevOps and Automation
601
- - Save deployment scripts with correct paths
602
- - Manage multiple environment configurations
603
- - Quick access to frequently used operations
604
-
605
- ## Best Practices
606
-
607
- 1. **Descriptive Names**: Use clear, memorable names for commands
608
- - Good: \`deploy-prod\`, \`test-unit\`, \`start-server\`
609
- - Avoid: \`cmd1\`, \`x\`, \`temp\`
610
-
611
- 2. **Use Aliases for Frequently Used Commands**
612
- - Create short aliases: \`aliasmate alias b build\`
613
- - Keyboard-friendly shortcuts speed up workflow
614
- - Use for commands you run multiple times daily
615
-
616
- 3. **Path Mode Selection**: Choose the right mode for each command
617
- - Use "saved" for project-specific commands
618
- - Use "current" for general utilities
619
-
620
- 4. **Preview with Dry-Run**: Verify before executing
621
- - Use \`--dry-run\` for destructive commands
622
- - Check environment variables with \`--verbose\`
623
- - Catch errors before they happen
624
-
625
- 5. **Validate Commands**: Let validation catch errors early
626
- - Default validation when saving prevents issues
627
- - Use \`--no-validate\` only when necessary
628
- - Run \`aliasmate validate --all\` periodically
629
-
630
- 6. **Regular Backups**: Export commands periodically
631
- - \`aliasmate export ~/backups/aliases-$(date +%Y%m%d).json\`
632
- - Use version control for team command exports
633
-
634
- 7. **Team Sharing**: Maintain a shared command repository
635
- - Export with masked sensitive values
636
- - Document complex commands
637
- - Use consistent naming conventions
638
-
639
- 8. **Command Organization**: Use prefixes for grouping
640
- - \`test-unit\`, \`test-integration\`, \`test-e2e\`
641
- - \`deploy-dev\`, \`deploy-staging\`, \`deploy-prod\`
642
-
643
- 9. **Environment Variables**: Capture when needed
644
- - Use for commands that need specific env vars
645
- - Review sensitive variables before saving
646
- - Keep environment variables updated with \`edit\` command
647
-
648
- 10. **Use Recent Commands**: Quick access to command history
649
- - \`aliasmate run @0\` for most recent
650
- - Review history with \`aliasmate recent\`
651
- - Clear old history periodically
652
-
653
- 11. **Stay Updated**: Check changelog regularly
654
- - Run \`aliasmate changelog\` to see new features
655
- - Update to latest version for bug fixes and improvements
656
-
657
- ## Integration with AI Assistants
658
-
659
- This llm.txt file is designed to help AI assistants understand AliasMate's full capabilities. When asking an AI for help with AliasMate:
660
-
661
- 1. Share this file for complete context
662
- 2. Mention specific commands you're working with
663
- 3. Describe your workflow or use case
664
- 4. Ask for command suggestions or optimizations
665
-
666
- ## Troubleshooting
667
-
668
- ### Command Not Found
669
- - Run \`aliasmate list\` to see available commands
670
- - Check if it's an alias: \`aliasmate alias --list\`
671
- - Check spelling of command name
672
- - Verify command was saved successfully
673
-
674
- ### Alias Not Working
675
- - Verify alias exists: \`aliasmate alias --list\`
676
- - Check if target command exists
677
- - Ensure alias name doesn't conflict with reserved names
678
- - Try running the target command directly first
679
-
680
- ### Recent Commands Not Showing
681
- - Check execution history: \`aliasmate recent\`
682
- - Verify commands were run (not in dry-run mode)
683
- - History might be full (default: 50 entries)
684
- - Clear old history: \`aliasmate recent --clear\`
685
-
686
- ### Validation Errors
687
- - Read the specific error message carefully
688
- - Check if command exists in PATH: \`which <command>\`
689
- - Verify directory exists and is accessible
690
- - Review shell syntax for quotes, brackets, pipes
691
- - Use \`--no-validate\` to bypass if error is false positive
692
-
693
- ### Directory Not Found
694
- - Ensure the saved directory still exists
695
- - Use path override to run in different location
696
- - Edit command to update directory: \`aliasmate edit <name>\`
697
- - Check directory permissions
698
-
699
- ### Command Execution Fails
700
- - Preview first: \`aliasmate run <name> --dry-run\`
701
- - Verify command syntax is correct
702
- - Check if required tools/dependencies are installed
703
- - Ensure directory permissions are correct
704
- - Review environment variables: use \`--dry-run --verbose\`
705
-
706
- ### Completion Not Working
707
- - Verify completion script is sourced correctly
708
- - Check shell type: \`echo $SHELL\`
709
- - Reload shell config: \`source ~/.bashrc\` or \`source ~/.zshrc\`
710
- - For fish, ensure file is in \`~/.config/fish/completions/\`
711
-
712
- ### Dry-Run Shows Incorrect Information
713
- - Verify saved command: \`aliasmate list\`
714
- - Check if command was updated recently
715
- - Review environment variables: use \`--verbose\` flag
716
- - Edit command if needed: \`aliasmate edit <name>\`
717
-
718
- ### Environment Variable Issues
719
- - Check if saved variables are still valid
720
- - Verify environment variable names and values
721
- - Use \`aliasmate edit <name>\` to update env vars
722
- - Clear environment variables if no longer needed
723
- - Preview with dry-run: \`aliasmate run <name> --dry-run --verbose\`
724
-
725
- ### Export/Import Format Issues
726
- - Verify format flag: \`--format json\` or \`--format yaml\`
727
- - Check file extension matches format
728
- - Validate JSON/YAML syntax if manually edited
729
- - Use \`--format json\` for most compatible exports
730
-
731
- ## Technical Details
732
-
733
- - Written in TypeScript
734
- - Cross-platform (Linux, macOS, Windows)
735
- - Node.js 14.0.0 or higher required
736
- - Dependencies: chalk, commander, execa, inquirer
737
-
738
- ## Getting Help
739
-
740
- - View all commands: \`aliasmate --help\`
741
- - View command help: \`aliasmate <command> --help\`
742
- - GitHub Issues: Report bugs or request features
743
- - Version info: \`aliasmate --version\`
744
-
745
- ## Example Workflows
746
-
747
- ### Frontend Development
748
- \`\`\`bash
749
- # Save development server
750
- npm run dev
751
- aliasmate prev dev
752
-
753
- # Save production build
754
- npm run build
755
- ### Environment-Specific Commands
756
- \`\`\`bash
757
- # Development environment
758
- NODE_ENV=development npm start
759
- aliasmate prev dev-server
760
- # Captures NODE_ENV automatically
761
-
762
- # Staging deployment
763
- API_URL=https://staging.api.com npm run deploy
764
- aliasmate prev deploy-staging
765
- # Captures API_URL automatically
766
-
767
- # Check what's new
768
- aliasmate changelog --from 1.2.0
769
- \`\`\`
770
-
771
- aliasmate prev build
772
-
773
- # Save test suite
774
- npm test
775
- aliasmate prev test
776
-
777
- # Run from anywhere
778
- aliasmate run dev
779
- aliasmate run build
780
- aliasmate run test
781
- \`\`\`
782
-
783
- ### Backend API
784
- \`\`\`bash
785
- # Save API server
786
- npm start
787
- aliasmate prev api
788
-
789
- # Save database migrations
790
- npm run migrate
791
- aliasmate prev migrate
792
-
793
- # Save seed data
794
- npm run seed
795
- aliasmate prev seed
796
- \`\`\`
797
-
798
- ### DevOps
799
- \`\`\`bash
800
- # Save deployment scripts
801
- ./scripts/deploy.sh production
802
- aliasmate prev deploy-prod
803
-
804
- # Preview before deploying (dry-run)
805
- aliasmate run deploy-prod --dry-run --verbose
806
-
807
- # Save log viewing
808
- tail -f /var/log/app.log
809
- aliasmate prev logs
810
-
811
- # Save health checks
812
- curl http://localhost:3000/health
813
- aliasmate prev health-check
814
- \`\`\`
815
-
816
- ### Using Aliases for Speed
817
- \`\`\`bash
818
- # Create aliases for frequently used commands
819
- aliasmate alias b build
820
- aliasmate alias t test
821
- aliasmate alias d deploy-prod
822
- aliasmate alias ds deploy-staging
823
-
824
- # Use aliases for quick execution
825
- aliasmate run b # Runs build
826
- aliasmate run t # Runs test
827
- aliasmate run d # Runs deploy-prod
828
-
829
- # List all aliases
830
- aliasmate alias --list
831
- \`\`\`
832
-
833
- ### Recent Commands Workflow
834
- \`\`\`bash
835
- # Run several commands
836
- aliasmate run build
837
- aliasmate run test
838
- aliasmate run deploy-staging
839
-
840
- # View recent commands
841
- aliasmate recent
842
-
843
- # Quickly re-run the last command
844
- aliasmate run @0
845
-
846
- # Re-run the build (if it was 2nd most recent)
847
- aliasmate run @1
848
- \`\`\`
849
-
850
- ### Validation and Safety
851
- \`\`\`bash
852
- # Validate a command before saving
853
- aliasmate save
854
- # (validation runs automatically)
855
-
856
- # Save without validation (advanced)
857
- aliasmate save --no-validate
858
-
859
- # Validate existing command
860
- aliasmate validate deploy-prod
861
-
862
- # Validate all commands
863
- aliasmate validate --all
864
-
865
- # Preview with dry-run before execution
866
- aliasmate run deploy-prod --dry-run --verbose
867
- \`\`\`
868
-
869
- ### Export and Sharing
870
- \`\`\`bash
871
- # Export in different formats
872
- aliasmate export team-commands.json --format json
873
- aliasmate export team-commands.yaml --format yaml
874
-
875
- # View commands in different formats
876
- aliasmate list --format json
877
- aliasmate list --format compact
878
- aliasmate list --format yaml
879
-
880
- # Share with team (sensitive values are masked)
881
- git add team-commands.yaml
882
- git commit -m "Update team commands"
883
- git push
884
- \`\`\`
885
-
886
- ---
887
-
888
- Generated by AliasMate v${constants_1.APP_VERSION}
889
- For more information, visit: https://github.com/aliasmate/aliasmate
890
- `;
891
- }
892
- /**
893
- * Create llm.txt file in the specified directory
894
- * @param targetDir - The directory where llm.txt should be created
895
- * @returns The full path to the created file
896
- */
897
- function createLLMFile(targetDir) {
898
- const content = generateLLMContent();
899
- const filePath = path.join(targetDir, 'llm.txt');
900
- fs.writeFileSync(filePath, content, 'utf8');
901
- return filePath;
902
- }
903
- /**
904
- * Get the default LLM command configuration
905
- * This command will be auto-created during onboarding
906
- */
907
- function getDefaultLLMCommand() {
908
- return {
909
- name: 'llm',
910
- command: `cat > llm.txt << 'ALIASMATE_LLM_EOF'\n${generateLLMContent()}\nALIASMATE_LLM_EOF\necho "✓ Created llm.txt in $(pwd)"`,
911
- directory: process.cwd(),
912
- pathMode: 'current', // Run in current directory so users can create llm.txt anywhere
913
- };
914
- }
915
- //# sourceMappingURL=llm-generator.js.map