aliasmate 1.5.1 → 1.6.1
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 +125 -0
- package/README.md +304 -3
- package/dist/cli.js +99 -13
- package/dist/cli.js.map +1 -1
- package/dist/commands/alias.d.ts +30 -0
- package/dist/commands/alias.d.ts.map +1 -0
- package/dist/commands/alias.js +213 -0
- package/dist/commands/alias.js.map +1 -0
- package/dist/commands/completion.d.ts +17 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +363 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/edit.d.ts +2 -1
- package/dist/commands/edit.d.ts.map +1 -1
- package/dist/commands/edit.js +44 -1
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/export.d.ts +7 -3
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +23 -10
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/list.d.ts +4 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +14 -71
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/recent.d.ts +24 -0
- package/dist/commands/recent.d.ts.map +1 -0
- package/dist/commands/recent.js +132 -0
- package/dist/commands/recent.js.map +1 -0
- package/dist/commands/run.d.ts +6 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +123 -11
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/save.d.ts +2 -1
- package/dist/commands/save.d.ts.map +1 -1
- package/dist/commands/save.js +44 -1
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/validate.d.ts +10 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +162 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/formatters.d.ts +30 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +188 -0
- package/dist/utils/formatters.js.map +1 -0
- package/dist/utils/llm-generator.d.ts.map +1 -1
- package/dist/utils/llm-generator.js +489 -27
- package/dist/utils/llm-generator.js.map +1 -1
- package/dist/utils/onboarding.d.ts.map +1 -1
- package/dist/utils/onboarding.js +57 -3
- package/dist/utils/onboarding.js.map +1 -1
- package/dist/utils/recent.d.ts +55 -0
- package/dist/utils/recent.d.ts.map +1 -0
- package/dist/utils/recent.js +102 -0
- package/dist/utils/recent.js.map +1 -0
- package/dist/utils/validator.d.ts +56 -0
- package/dist/utils/validator.d.ts.map +1 -0
- package/dist/utils/validator.js +413 -0
- package/dist/utils/validator.js.map +1 -0
- package/package.json +1 -1
- package/whats-new.json +48 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new alias for a saved command
|
|
3
|
+
* @param shortAlias - The short alias name to create
|
|
4
|
+
* @param commandName - The full command name to alias
|
|
5
|
+
*/
|
|
6
|
+
export declare function createAliasCommand(shortAlias: string, commandName: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* List all aliases
|
|
9
|
+
*/
|
|
10
|
+
export declare function listAliasesCommand(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Remove an alias
|
|
13
|
+
* @param shortAlias - The alias name to remove
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeAliasCommand(shortAlias: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve an alias to its target command name
|
|
18
|
+
* If the name is an alias, returns the target command name
|
|
19
|
+
* If not an alias, returns the original name
|
|
20
|
+
* @param name - The name to resolve (could be an alias or a command name)
|
|
21
|
+
* @returns The resolved command name
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveAlias(name: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Check if a name is an alias
|
|
26
|
+
* @param name - The name to check
|
|
27
|
+
* @returns true if it's an alias, false otherwise
|
|
28
|
+
*/
|
|
29
|
+
export declare function isAlias(name: string): boolean;
|
|
30
|
+
//# sourceMappingURL=alias.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.d.ts","sourceRoot":"","sources":["../../src/commands/alias.ts"],"names":[],"mappings":"AAmFA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CA4ChF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAkCzC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAsC3D;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG7C"}
|
|
@@ -0,0 +1,213 @@
|
|
|
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.createAliasCommand = createAliasCommand;
|
|
7
|
+
exports.listAliasesCommand = listAliasesCommand;
|
|
8
|
+
exports.removeAliasCommand = removeAliasCommand;
|
|
9
|
+
exports.resolveAlias = resolveAlias;
|
|
10
|
+
exports.isAlias = isAlias;
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
const storage_1 = require("../storage");
|
|
13
|
+
const storage_2 = require("../storage");
|
|
14
|
+
const errors_1 = require("../utils/errors");
|
|
15
|
+
const constants_1 = require("../utils/constants");
|
|
16
|
+
const METADATA_KEY_ALIASES = 'command_aliases';
|
|
17
|
+
/**
|
|
18
|
+
* Load the alias mappings from metadata
|
|
19
|
+
* @returns The alias mapping object
|
|
20
|
+
*/
|
|
21
|
+
function loadAliasMappings() {
|
|
22
|
+
const metadata = (0, storage_2.loadMetadata)();
|
|
23
|
+
return metadata[METADATA_KEY_ALIASES] || {};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Save the alias mappings to metadata
|
|
27
|
+
* @param mappings - The alias mappings to save
|
|
28
|
+
* @returns true if successful, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
function saveAliasMappings(mappings) {
|
|
31
|
+
const metadata = (0, storage_2.loadMetadata)();
|
|
32
|
+
metadata[METADATA_KEY_ALIASES] = mappings;
|
|
33
|
+
return (0, storage_2.saveMetadata)(metadata);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validate alias name
|
|
37
|
+
* - Must not be empty
|
|
38
|
+
* - Must not contain spaces or special characters (only alphanumeric, dash, underscore)
|
|
39
|
+
* - Must not be a reserved command name
|
|
40
|
+
* @param alias - The alias name to validate
|
|
41
|
+
* @returns true if valid, throws error otherwise
|
|
42
|
+
*/
|
|
43
|
+
function validateAliasName(alias) {
|
|
44
|
+
if (!alias || !alias.trim()) {
|
|
45
|
+
throw new Error('Alias name cannot be empty');
|
|
46
|
+
}
|
|
47
|
+
// Check for valid characters (alphanumeric, dash, underscore)
|
|
48
|
+
const validPattern = /^[a-zA-Z0-9_-]+$/;
|
|
49
|
+
if (!validPattern.test(alias)) {
|
|
50
|
+
throw new Error('Alias name can only contain letters, numbers, dashes, and underscores');
|
|
51
|
+
}
|
|
52
|
+
// Reserved commands that cannot be used as aliases
|
|
53
|
+
const reservedCommands = [
|
|
54
|
+
'prev',
|
|
55
|
+
'run',
|
|
56
|
+
'save',
|
|
57
|
+
'list',
|
|
58
|
+
'ls',
|
|
59
|
+
'search',
|
|
60
|
+
'find',
|
|
61
|
+
'delete',
|
|
62
|
+
'rm',
|
|
63
|
+
'edit',
|
|
64
|
+
'export',
|
|
65
|
+
'import',
|
|
66
|
+
'config',
|
|
67
|
+
'changelog',
|
|
68
|
+
'alias',
|
|
69
|
+
'help',
|
|
70
|
+
'version',
|
|
71
|
+
];
|
|
72
|
+
if (reservedCommands.includes(alias.toLowerCase())) {
|
|
73
|
+
throw new Error(`"${alias}" is a reserved command name and cannot be used as an alias`);
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a new alias for a saved command
|
|
79
|
+
* @param shortAlias - The short alias name to create
|
|
80
|
+
* @param commandName - The full command name to alias
|
|
81
|
+
*/
|
|
82
|
+
function createAliasCommand(shortAlias, commandName) {
|
|
83
|
+
try {
|
|
84
|
+
// Validate inputs
|
|
85
|
+
if (!commandName || !commandName.trim()) {
|
|
86
|
+
(0, errors_1.exitWithError)('Command name cannot be empty', errors_1.ExitCode.InvalidInput);
|
|
87
|
+
}
|
|
88
|
+
// Validate the alias name
|
|
89
|
+
validateAliasName(shortAlias);
|
|
90
|
+
// Check if the target command exists
|
|
91
|
+
const targetCommand = (0, storage_1.getAlias)(commandName);
|
|
92
|
+
if (!targetCommand) {
|
|
93
|
+
console.error(chalk_1.default.red(`Error: ${constants_1.ERROR_MESSAGES.commandNotFound(commandName)}`));
|
|
94
|
+
console.log(chalk_1.default.yellow(constants_1.HELP_MESSAGES.useList));
|
|
95
|
+
process.exit(errors_1.ExitCode.InvalidInput);
|
|
96
|
+
}
|
|
97
|
+
// Load existing alias mappings
|
|
98
|
+
const mappings = loadAliasMappings();
|
|
99
|
+
// Check if alias already exists
|
|
100
|
+
if (mappings[shortAlias]) {
|
|
101
|
+
console.log(chalk_1.default.yellow(`Alias "${shortAlias}" already points to "${mappings[shortAlias]}"`));
|
|
102
|
+
console.log(chalk_1.default.gray(`Updating to point to "${commandName}"`));
|
|
103
|
+
}
|
|
104
|
+
// Create the alias mapping
|
|
105
|
+
mappings[shortAlias] = commandName;
|
|
106
|
+
// Save the mappings
|
|
107
|
+
const success = saveAliasMappings(mappings);
|
|
108
|
+
if (success) {
|
|
109
|
+
console.log(chalk_1.default.green(`✓ Created alias "${shortAlias}" → "${commandName}"`));
|
|
110
|
+
console.log(chalk_1.default.gray(` You can now run: aliasmate run ${shortAlias}`));
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
(0, errors_1.exitWithError)('Failed to save alias', errors_1.ExitCode.GeneralError);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
(0, errors_1.handleError)(error, 'Failed to create alias');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* List all aliases
|
|
122
|
+
*/
|
|
123
|
+
function listAliasesCommand() {
|
|
124
|
+
try {
|
|
125
|
+
const mappings = loadAliasMappings();
|
|
126
|
+
const aliases = Object.keys(mappings);
|
|
127
|
+
if (aliases.length === 0) {
|
|
128
|
+
console.log(chalk_1.default.yellow('No aliases defined.'));
|
|
129
|
+
console.log(chalk_1.default.gray('Create an alias with: aliasmate alias <alias-name> <command-name>'));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
console.log(chalk_1.default.bold(`\nAliases (${aliases.length}):\n`));
|
|
133
|
+
// Sort alphabetically
|
|
134
|
+
aliases.sort();
|
|
135
|
+
for (const alias of aliases) {
|
|
136
|
+
const commandName = mappings[alias];
|
|
137
|
+
const command = (0, storage_1.getAlias)(commandName);
|
|
138
|
+
if (command) {
|
|
139
|
+
console.log(chalk_1.default.cyan(` ${alias} → ${commandName}`));
|
|
140
|
+
console.log(chalk_1.default.gray(` Command: ${command.command}`));
|
|
141
|
+
console.log(chalk_1.default.gray(` Directory: ${command.directory}`));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// The mapped command no longer exists
|
|
145
|
+
console.log(chalk_1.default.cyan(` ${alias} → ${commandName}`));
|
|
146
|
+
console.log(chalk_1.default.red(` ⚠️ Target command not found`));
|
|
147
|
+
}
|
|
148
|
+
console.log();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
(0, errors_1.handleError)(error, 'Failed to list aliases');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Remove an alias
|
|
157
|
+
* @param shortAlias - The alias name to remove
|
|
158
|
+
*/
|
|
159
|
+
function removeAliasCommand(shortAlias) {
|
|
160
|
+
try {
|
|
161
|
+
// Validate input
|
|
162
|
+
if (!shortAlias || !shortAlias.trim()) {
|
|
163
|
+
(0, errors_1.exitWithError)('Alias name cannot be empty', errors_1.ExitCode.InvalidInput);
|
|
164
|
+
}
|
|
165
|
+
// Load existing alias mappings
|
|
166
|
+
const mappings = loadAliasMappings();
|
|
167
|
+
// Check if alias exists
|
|
168
|
+
if (!mappings[shortAlias]) {
|
|
169
|
+
console.error(chalk_1.default.red(`Error: Alias "${shortAlias}" not found`));
|
|
170
|
+
console.log(chalk_1.default.yellow('Use "aliasmate alias --list" to see all aliases'));
|
|
171
|
+
process.exit(errors_1.ExitCode.InvalidInput);
|
|
172
|
+
}
|
|
173
|
+
const targetCommand = mappings[shortAlias];
|
|
174
|
+
// Show what will be removed
|
|
175
|
+
console.log(chalk_1.default.yellow(`Removing alias:`));
|
|
176
|
+
console.log(chalk_1.default.gray(` Alias: ${shortAlias}`));
|
|
177
|
+
console.log(chalk_1.default.gray(` Points to: ${targetCommand}\n`));
|
|
178
|
+
// Remove the alias
|
|
179
|
+
delete mappings[shortAlias];
|
|
180
|
+
// Save the updated mappings
|
|
181
|
+
const success = saveAliasMappings(mappings);
|
|
182
|
+
if (success) {
|
|
183
|
+
console.log(chalk_1.default.green(`✓ Removed alias "${shortAlias}"`));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
(0, errors_1.exitWithError)('Failed to remove alias', errors_1.ExitCode.GeneralError);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
(0, errors_1.handleError)(error, 'Failed to remove alias');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Resolve an alias to its target command name
|
|
195
|
+
* If the name is an alias, returns the target command name
|
|
196
|
+
* If not an alias, returns the original name
|
|
197
|
+
* @param name - The name to resolve (could be an alias or a command name)
|
|
198
|
+
* @returns The resolved command name
|
|
199
|
+
*/
|
|
200
|
+
function resolveAlias(name) {
|
|
201
|
+
const mappings = loadAliasMappings();
|
|
202
|
+
return mappings[name] || name;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Check if a name is an alias
|
|
206
|
+
* @param name - The name to check
|
|
207
|
+
* @returns true if it's an alias, false otherwise
|
|
208
|
+
*/
|
|
209
|
+
function isAlias(name) {
|
|
210
|
+
const mappings = loadAliasMappings();
|
|
211
|
+
return name in mappings;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=alias.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias.js","sourceRoot":"","sources":["../../src/commands/alias.ts"],"names":[],"mappings":";;;;;AAwFA,gDA4CC;AAKD,gDAkCC;AAMD,gDAsCC;AASD,oCAGC;AAOD,0BAGC;AA7OD,kDAA0B;AAC1B,wCAAsC;AACtC,wCAAwD;AACxD,4CAAuE;AACvE,kDAAmE;AAUnE,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAE/C;;;GAGG;AACH,SAAS,iBAAiB;IACxB,MAAM,QAAQ,GAAG,IAAA,sBAAY,GAAE,CAAC;IAChC,OAAQ,QAAQ,CAAC,oBAAoB,CAAkB,IAAI,EAAE,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,QAAsB;IAC/C,MAAM,QAAQ,GAAG,IAAA,sBAAY,GAAE,CAAC;IAChC,QAAQ,CAAC,oBAAoB,CAAC,GAAG,QAAQ,CAAC;IAC1C,OAAO,IAAA,sBAAY,EAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,iBAAiB,CAAC,KAAa;IACtC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,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,eAAK,CAAC,KAAK,CAAC,oBAAoB,UAAU,GAAG,CAAC,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,IAAA,sBAAa,EAAC,wBAAwB,EAAE,iBAAQ,CAAC,YAAY,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,oBAAW,EAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IACrC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CAAC,IAAY;IAClC,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IACrC,OAAO,IAAI,IAAI,QAAQ,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate bash completion script
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateBashCompletion(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Generate zsh completion script
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateZshCompletion(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate fish completion script
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateFishCompletion(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Display completion script for specified shell
|
|
15
|
+
*/
|
|
16
|
+
export declare function completionCommand(shell?: string): void;
|
|
17
|
+
//# sourceMappingURL=completion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CA+I/C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAgG9C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAsE/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAoCtD"}
|
|
@@ -0,0 +1,363 @@
|
|
|
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.generateBashCompletion = generateBashCompletion;
|
|
7
|
+
exports.generateZshCompletion = generateZshCompletion;
|
|
8
|
+
exports.generateFishCompletion = generateFishCompletion;
|
|
9
|
+
exports.completionCommand = completionCommand;
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const storage_1 = require("../storage");
|
|
12
|
+
/**
|
|
13
|
+
* Generate bash completion script
|
|
14
|
+
*/
|
|
15
|
+
function generateBashCompletion() {
|
|
16
|
+
const aliases = (0, storage_1.loadAliases)();
|
|
17
|
+
const commandNames = Object.keys(aliases);
|
|
18
|
+
const commandList = commandNames.join(' ');
|
|
19
|
+
return `# Bash completion for aliasmate
|
|
20
|
+
# Source this file or add it to your ~/.bashrc:
|
|
21
|
+
# source <(aliasmate completion bash)
|
|
22
|
+
|
|
23
|
+
_aliasmate_completion() {
|
|
24
|
+
local cur prev opts base
|
|
25
|
+
COMPREPLY=()
|
|
26
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
27
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
28
|
+
|
|
29
|
+
# Main commands
|
|
30
|
+
local commands="prev run save list ls search find recent delete rm edit export import changelog alias validate config completion"
|
|
31
|
+
|
|
32
|
+
# Saved command names
|
|
33
|
+
local saved_commands="${commandList}"
|
|
34
|
+
|
|
35
|
+
# Options for specific commands
|
|
36
|
+
case "\${COMP_WORDS[1]}" in
|
|
37
|
+
run)
|
|
38
|
+
case "\${prev}" in
|
|
39
|
+
run)
|
|
40
|
+
COMPREPLY=( $(compgen -W "\${saved_commands}" -- \${cur}) )
|
|
41
|
+
return 0
|
|
42
|
+
;;
|
|
43
|
+
--format)
|
|
44
|
+
COMPREPLY=( $(compgen -W "table json yaml compact" -- \${cur}) )
|
|
45
|
+
return 0
|
|
46
|
+
;;
|
|
47
|
+
*)
|
|
48
|
+
if [[ \${cur} == -* ]] ; then
|
|
49
|
+
COMPREPLY=( $(compgen -W "--dry-run --verbose" -- \${cur}) )
|
|
50
|
+
return 0
|
|
51
|
+
else
|
|
52
|
+
COMPREPLY=( $(compgen -d -- \${cur}) )
|
|
53
|
+
return 0
|
|
54
|
+
fi
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
;;
|
|
58
|
+
list|ls)
|
|
59
|
+
case "\${prev}" in
|
|
60
|
+
--format)
|
|
61
|
+
COMPREPLY=( $(compgen -W "table json yaml compact" -- \${cur}) )
|
|
62
|
+
return 0
|
|
63
|
+
;;
|
|
64
|
+
*)
|
|
65
|
+
if [[ \${cur} == -* ]] ; then
|
|
66
|
+
COMPREPLY=( $(compgen -W "--format" -- \${cur}) )
|
|
67
|
+
return 0
|
|
68
|
+
fi
|
|
69
|
+
;;
|
|
70
|
+
esac
|
|
71
|
+
;;
|
|
72
|
+
export)
|
|
73
|
+
case "\${prev}" in
|
|
74
|
+
--format)
|
|
75
|
+
COMPREPLY=( $(compgen -W "json yaml" -- \${cur}) )
|
|
76
|
+
return 0
|
|
77
|
+
;;
|
|
78
|
+
export)
|
|
79
|
+
COMPREPLY=( $(compgen -f -- \${cur}) )
|
|
80
|
+
return 0
|
|
81
|
+
;;
|
|
82
|
+
*)
|
|
83
|
+
if [[ \${cur} == -* ]] ; then
|
|
84
|
+
COMPREPLY=( $(compgen -W "--format" -- \${cur}) )
|
|
85
|
+
return 0
|
|
86
|
+
fi
|
|
87
|
+
;;
|
|
88
|
+
esac
|
|
89
|
+
;;
|
|
90
|
+
import)
|
|
91
|
+
case "\${prev}" in
|
|
92
|
+
import)
|
|
93
|
+
COMPREPLY=( $(compgen -f -- \${cur}) )
|
|
94
|
+
return 0
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
;;
|
|
98
|
+
delete|rm|edit|validate|prev)
|
|
99
|
+
case "\${prev}" in
|
|
100
|
+
delete|rm|edit|validate|prev)
|
|
101
|
+
COMPREPLY=( $(compgen -W "\${saved_commands}" -- \${cur}) )
|
|
102
|
+
return 0
|
|
103
|
+
;;
|
|
104
|
+
esac
|
|
105
|
+
;;
|
|
106
|
+
alias)
|
|
107
|
+
case "\${prev}" in
|
|
108
|
+
alias)
|
|
109
|
+
if [[ \${cur} == -* ]] ; then
|
|
110
|
+
COMPREPLY=( $(compgen -W "--list --remove" -- \${cur}) )
|
|
111
|
+
return 0
|
|
112
|
+
fi
|
|
113
|
+
;;
|
|
114
|
+
--remove)
|
|
115
|
+
# Get aliases from storage
|
|
116
|
+
COMPREPLY=( $(compgen -W "\${saved_commands}" -- \${cur}) )
|
|
117
|
+
return 0
|
|
118
|
+
;;
|
|
119
|
+
esac
|
|
120
|
+
;;
|
|
121
|
+
recent)
|
|
122
|
+
case "\${prev}" in
|
|
123
|
+
--limit)
|
|
124
|
+
return 0
|
|
125
|
+
;;
|
|
126
|
+
*)
|
|
127
|
+
if [[ \${cur} == -* ]] ; then
|
|
128
|
+
COMPREPLY=( $(compgen -W "--limit --clear" -- \${cur}) )
|
|
129
|
+
return 0
|
|
130
|
+
fi
|
|
131
|
+
;;
|
|
132
|
+
esac
|
|
133
|
+
;;
|
|
134
|
+
save)
|
|
135
|
+
if [[ \${cur} == -* ]] ; then
|
|
136
|
+
COMPREPLY=( $(compgen -W "--no-validate" -- \${cur}) )
|
|
137
|
+
return 0
|
|
138
|
+
fi
|
|
139
|
+
;;
|
|
140
|
+
completion)
|
|
141
|
+
case "\${prev}" in
|
|
142
|
+
completion)
|
|
143
|
+
COMPREPLY=( $(compgen -W "bash zsh fish" -- \${cur}) )
|
|
144
|
+
return 0
|
|
145
|
+
;;
|
|
146
|
+
esac
|
|
147
|
+
;;
|
|
148
|
+
*)
|
|
149
|
+
COMPREPLY=( $(compgen -W "\${commands}" -- \${cur}) )
|
|
150
|
+
return 0
|
|
151
|
+
;;
|
|
152
|
+
esac
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
complete -F _aliasmate_completion aliasmate
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Generate zsh completion script
|
|
160
|
+
*/
|
|
161
|
+
function generateZshCompletion() {
|
|
162
|
+
const aliases = (0, storage_1.loadAliases)();
|
|
163
|
+
const commandNames = Object.keys(aliases);
|
|
164
|
+
const commandList = commandNames.map((name) => `'${name}'`).join(' ');
|
|
165
|
+
return `#compdef aliasmate
|
|
166
|
+
# Zsh completion for aliasmate
|
|
167
|
+
# Add this file to your fpath or add to ~/.zshrc:
|
|
168
|
+
# source <(aliasmate completion zsh)
|
|
169
|
+
|
|
170
|
+
_aliasmate() {
|
|
171
|
+
local line state
|
|
172
|
+
|
|
173
|
+
_arguments -C \\
|
|
174
|
+
"1: :->cmds" \\
|
|
175
|
+
"*::arg:->args"
|
|
176
|
+
|
|
177
|
+
case "$state" in
|
|
178
|
+
cmds)
|
|
179
|
+
_values 'commands' \\
|
|
180
|
+
'prev[Save previous command from history]' \\
|
|
181
|
+
'run[Run a saved command]' \\
|
|
182
|
+
'save[Interactively save a command]' \\
|
|
183
|
+
'list[List all saved commands]' \\
|
|
184
|
+
'ls[List all saved commands]' \\
|
|
185
|
+
'search[Search for commands]' \\
|
|
186
|
+
'find[Search for commands]' \\
|
|
187
|
+
'recent[Show recently executed commands]' \\
|
|
188
|
+
'delete[Delete a saved command]' \\
|
|
189
|
+
'rm[Delete a saved command]' \\
|
|
190
|
+
'edit[Edit a saved command]' \\
|
|
191
|
+
'export[Export commands to file]' \\
|
|
192
|
+
'import[Import commands from file]' \\
|
|
193
|
+
'changelog[View version changelog]' \\
|
|
194
|
+
'alias[Create, list, or remove aliases]' \\
|
|
195
|
+
'validate[Validate command(s)]' \\
|
|
196
|
+
'config[Show config file location]' \\
|
|
197
|
+
'completion[Generate shell completion script]'
|
|
198
|
+
;;
|
|
199
|
+
args)
|
|
200
|
+
case "$line[1]" in
|
|
201
|
+
run)
|
|
202
|
+
_arguments \\
|
|
203
|
+
'1:command name:(${commandList})' \\
|
|
204
|
+
'2:path:_files -/' \\
|
|
205
|
+
'--dry-run[Preview without executing]' \\
|
|
206
|
+
'--verbose[Show detailed information]'
|
|
207
|
+
;;
|
|
208
|
+
list|ls)
|
|
209
|
+
_arguments \\
|
|
210
|
+
'--format[Output format]:format:(table json yaml compact)'
|
|
211
|
+
;;
|
|
212
|
+
export)
|
|
213
|
+
_arguments \\
|
|
214
|
+
'1:file:_files' \\
|
|
215
|
+
'--format[Output format]:format:(json yaml)'
|
|
216
|
+
;;
|
|
217
|
+
import)
|
|
218
|
+
_arguments \\
|
|
219
|
+
'1:file:_files'
|
|
220
|
+
;;
|
|
221
|
+
delete|rm|edit|validate|prev)
|
|
222
|
+
_arguments \\
|
|
223
|
+
"1:command name:(${commandList})"
|
|
224
|
+
;;
|
|
225
|
+
search|find)
|
|
226
|
+
_arguments \\
|
|
227
|
+
'1:query:'
|
|
228
|
+
;;
|
|
229
|
+
alias)
|
|
230
|
+
_arguments \\
|
|
231
|
+
'1:alias name:' \\
|
|
232
|
+
'2:command name:(${commandList})' \\
|
|
233
|
+
'--list[List all aliases]' \\
|
|
234
|
+
'--remove[Remove an alias]:alias:(${commandList})'
|
|
235
|
+
;;
|
|
236
|
+
recent)
|
|
237
|
+
_arguments \\
|
|
238
|
+
'--limit[Maximum number to display]:limit:' \\
|
|
239
|
+
'--clear[Clear execution history]'
|
|
240
|
+
;;
|
|
241
|
+
save)
|
|
242
|
+
_arguments \\
|
|
243
|
+
'--no-validate[Skip validation checks]'
|
|
244
|
+
;;
|
|
245
|
+
completion)
|
|
246
|
+
_arguments \\
|
|
247
|
+
'1:shell:(bash zsh fish)'
|
|
248
|
+
;;
|
|
249
|
+
esac
|
|
250
|
+
;;
|
|
251
|
+
esac
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
compdef _aliasmate aliasmate
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Generate fish completion script
|
|
259
|
+
*/
|
|
260
|
+
function generateFishCompletion() {
|
|
261
|
+
const aliases = (0, storage_1.loadAliases)();
|
|
262
|
+
const commandNames = Object.keys(aliases);
|
|
263
|
+
const commandCompletions = commandNames
|
|
264
|
+
.map((name) => `complete -c aliasmate -n "__fish_seen_subcommand_from run delete rm edit validate prev" -a "${name}"`)
|
|
265
|
+
.join('\n');
|
|
266
|
+
return `# Fish completion for aliasmate
|
|
267
|
+
# Save this to ~/.config/fish/completions/aliasmate.fish or add to your config:
|
|
268
|
+
# aliasmate completion fish > ~/.config/fish/completions/aliasmate.fish
|
|
269
|
+
|
|
270
|
+
# Disable file completion by default
|
|
271
|
+
complete -c aliasmate -f
|
|
272
|
+
|
|
273
|
+
# Main commands
|
|
274
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "prev" -d "Save previous command from history"
|
|
275
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "run" -d "Run a saved command"
|
|
276
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "save" -d "Interactively save a command"
|
|
277
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "list" -d "List all saved commands"
|
|
278
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "ls" -d "List all saved commands"
|
|
279
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "search" -d "Search for commands"
|
|
280
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "find" -d "Search for commands"
|
|
281
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "recent" -d "Show recently executed commands"
|
|
282
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "delete" -d "Delete a saved command"
|
|
283
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "rm" -d "Delete a saved command"
|
|
284
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "edit" -d "Edit a saved command"
|
|
285
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "export" -d "Export commands to file"
|
|
286
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "import" -d "Import commands from file"
|
|
287
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "changelog" -d "View version changelog"
|
|
288
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "alias" -d "Create, list, or remove aliases"
|
|
289
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "validate" -d "Validate command(s)"
|
|
290
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "config" -d "Show config file location"
|
|
291
|
+
complete -c aliasmate -n "__fish_use_subcommand" -a "completion" -d "Generate shell completion script"
|
|
292
|
+
|
|
293
|
+
# Saved command completions
|
|
294
|
+
${commandCompletions}
|
|
295
|
+
|
|
296
|
+
# run command options
|
|
297
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from run" -l dry-run -d "Preview without executing"
|
|
298
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from run" -l verbose -d "Show detailed information"
|
|
299
|
+
|
|
300
|
+
# list/ls command options
|
|
301
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from list ls" -l format -d "Output format" -a "table json yaml compact"
|
|
302
|
+
|
|
303
|
+
# export command options
|
|
304
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from export" -l format -d "Output format" -a "json yaml"
|
|
305
|
+
|
|
306
|
+
# alias command options
|
|
307
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from alias" -l list -d "List all aliases"
|
|
308
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from alias" -l remove -d "Remove an alias"
|
|
309
|
+
|
|
310
|
+
# recent command options
|
|
311
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from recent" -l limit -d "Maximum number to display"
|
|
312
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from recent" -l clear -d "Clear execution history"
|
|
313
|
+
|
|
314
|
+
# save command options
|
|
315
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from save" -l no-validate -d "Skip validation checks"
|
|
316
|
+
|
|
317
|
+
# validate command options
|
|
318
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from validate" -l all -d "Validate all saved commands"
|
|
319
|
+
|
|
320
|
+
# completion command shell types
|
|
321
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from completion" -a "bash zsh fish" -d "Shell type"
|
|
322
|
+
|
|
323
|
+
# File completions for import/export
|
|
324
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from import export" -F
|
|
325
|
+
`;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Display completion script for specified shell
|
|
329
|
+
*/
|
|
330
|
+
function completionCommand(shell) {
|
|
331
|
+
if (!shell) {
|
|
332
|
+
console.log(chalk_1.default.yellow('Usage: aliasmate completion <shell>'));
|
|
333
|
+
console.log(chalk_1.default.gray('\nAvailable shells:'));
|
|
334
|
+
console.log(chalk_1.default.gray(' bash - Generate bash completion script'));
|
|
335
|
+
console.log(chalk_1.default.gray(' zsh - Generate zsh completion script'));
|
|
336
|
+
console.log(chalk_1.default.gray(' fish - Generate fish completion script'));
|
|
337
|
+
console.log(chalk_1.default.gray('\nExamples:'));
|
|
338
|
+
console.log(chalk_1.default.cyan(' # Bash'));
|
|
339
|
+
console.log(chalk_1.default.gray(' source <(aliasmate completion bash)'));
|
|
340
|
+
console.log(chalk_1.default.cyan('\n # Zsh'));
|
|
341
|
+
console.log(chalk_1.default.gray(' source <(aliasmate completion zsh)'));
|
|
342
|
+
console.log(chalk_1.default.cyan('\n # Fish'));
|
|
343
|
+
console.log(chalk_1.default.gray(' aliasmate completion fish > ~/.config/fish/completions/aliasmate.fish'));
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const normalizedShell = shell.toLowerCase();
|
|
347
|
+
switch (normalizedShell) {
|
|
348
|
+
case 'bash':
|
|
349
|
+
console.log(generateBashCompletion());
|
|
350
|
+
break;
|
|
351
|
+
case 'zsh':
|
|
352
|
+
console.log(generateZshCompletion());
|
|
353
|
+
break;
|
|
354
|
+
case 'fish':
|
|
355
|
+
console.log(generateFishCompletion());
|
|
356
|
+
break;
|
|
357
|
+
default:
|
|
358
|
+
console.error(chalk_1.default.red(`Error: Unsupported shell "${shell}"`));
|
|
359
|
+
console.log(chalk_1.default.yellow('Supported shells: bash, zsh, fish'));
|
|
360
|
+
process.exit(1);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=completion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":";;;;;AAMA,wDA+IC;AAKD,sDAgGC;AAKD,wDAsEC;AAKD,8CAoCC;AA9WD,kDAA0B;AAC1B,wCAAyC;AAEzC;;GAEG;AACH,SAAgB,sBAAsB;IACpC,MAAM,OAAO,GAAG,IAAA,qBAAW,GAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO;;;;;;;;;;;;;;4BAcmB,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2HtC,CAAC;AACF,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,MAAM,OAAO,GAAG,IAAA,qBAAW,GAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,C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- The name of the command to edit
|
|
5
|
+
* @param shouldValidate - Whether to validate the command (defaults to true)
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
8
|
* ```
|
|
@@ -11,5 +12,5 @@
|
|
|
11
12
|
* await editCommand('build-prod');
|
|
12
13
|
* ```
|
|
13
14
|
*/
|
|
14
|
-
export declare function editCommand(name: string): Promise<void>;
|
|
15
|
+
export declare function editCommand(name: string, shouldValidate?: boolean): Promise<void>;
|
|
15
16
|
//# sourceMappingURL=edit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/commands/edit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/commands/edit.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAgP7F"}
|