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
@@ -0,0 +1,11 @@
1
+ export interface ExecutionResult {
2
+ success: boolean;
3
+ stdout: string;
4
+ stderr: string;
5
+ }
6
+ /**
7
+ * Execute a command in a specific directory
8
+ * Cross-platform command execution using execa
9
+ */
10
+ export declare function executeCommand(command: string, cwd: string): Promise<ExecutionResult>;
11
+ //# sourceMappingURL=executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../src/utils/executor.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA8B3F"}
@@ -0,0 +1,76 @@
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.executeCommand = executeCommand;
40
+ const execa_1 = __importDefault(require("execa"));
41
+ const path = __importStar(require("path"));
42
+ const fs = __importStar(require("fs"));
43
+ /**
44
+ * Execute a command in a specific directory
45
+ * Cross-platform command execution using execa
46
+ */
47
+ async function executeCommand(command, cwd) {
48
+ try {
49
+ // Resolve the directory path
50
+ const resolvedCwd = path.resolve(cwd);
51
+ // Check if directory exists
52
+ if (!fs.existsSync(resolvedCwd)) {
53
+ throw new Error(`Directory does not exist: ${resolvedCwd}`);
54
+ }
55
+ // Execute the command using the user's shell
56
+ // stdio: 'inherit' allows real-time output to terminal
57
+ await (0, execa_1.default)(command, {
58
+ shell: true,
59
+ cwd: resolvedCwd,
60
+ stdio: 'inherit'
61
+ });
62
+ return {
63
+ success: true,
64
+ stdout: '',
65
+ stderr: ''
66
+ };
67
+ }
68
+ catch (error) {
69
+ return {
70
+ success: false,
71
+ stdout: error.stdout || '',
72
+ stderr: error.stderr || error.message
73
+ };
74
+ }
75
+ }
76
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executor.js","sourceRoot":"","sources":["../../src/utils/executor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,wCA8BC;AA5CD,kDAA0B;AAC1B,2CAA6B;AAC7B,uCAAyB;AAQzB;;;GAGG;AACI,KAAK,UAAU,cAAc,CAAC,OAAe,EAAE,GAAW;IAC/D,IAAI,CAAC;QACH,6BAA6B;QAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAEtC,4BAA4B;QAC5B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,6BAA6B,WAAW,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,6CAA6C;QAC7C,uDAAuD;QACvD,MAAM,IAAA,eAAK,EAAC,OAAO,EAAE;YACnB,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,WAAW;YAChB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO;SACtC,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Get the last command from shell history
3
+ *
4
+ * IMPORTANT: This implementation reads from the shell history file,
5
+ * which may not include the most recent commands until the shell writes them.
6
+ *
7
+ * For best results, users should configure their shell for immediate history writing:
8
+ * - zsh: Add "setopt INC_APPEND_HISTORY" or "setopt SHARE_HISTORY" to ~/.zshrc
9
+ * - bash: Add "PROMPT_COMMAND='history -a'" to ~/.bashrc
10
+ * - PowerShell (Windows): History is written immediately by default
11
+ *
12
+ * Alternative: Use environment variable ALIASMATE_LAST_CMD passed from parent shell
13
+ */
14
+ export declare function getLastCommand(): string | null;
15
+ /**
16
+ * Get shell-specific configuration instructions for real-time history
17
+ */
18
+ export declare function getHistoryConfigInstructions(): string;
19
+ //# sourceMappingURL=history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/utils/history.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CA8F9C;AAED;;GAEG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAsBrD"}
@@ -0,0 +1,161 @@
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.getLastCommand = getLastCommand;
37
+ exports.getHistoryConfigInstructions = getHistoryConfigInstructions;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const os = __importStar(require("os"));
41
+ /**
42
+ * Get the last command from shell history
43
+ *
44
+ * IMPORTANT: This implementation reads from the shell history file,
45
+ * which may not include the most recent commands until the shell writes them.
46
+ *
47
+ * For best results, users should configure their shell for immediate history writing:
48
+ * - zsh: Add "setopt INC_APPEND_HISTORY" or "setopt SHARE_HISTORY" to ~/.zshrc
49
+ * - bash: Add "PROMPT_COMMAND='history -a'" to ~/.bashrc
50
+ * - PowerShell (Windows): History is written immediately by default
51
+ *
52
+ * Alternative: Use environment variable ALIASMATE_LAST_CMD passed from parent shell
53
+ */
54
+ function getLastCommand() {
55
+ try {
56
+ // Check if the command was passed via environment variable
57
+ // This allows shell integration: export ALIASMATE_LAST_CMD="$(!:0-1)"
58
+ if (process.env.ALIASMATE_LAST_CMD) {
59
+ const cmd = process.env.ALIASMATE_LAST_CMD.trim();
60
+ if (cmd && !cmd.startsWith('aliasmate')) {
61
+ return cmd;
62
+ }
63
+ }
64
+ const homeDir = os.homedir();
65
+ const platform = os.platform();
66
+ let historyFile = null;
67
+ // Determine history file based on platform and shell
68
+ if (platform === 'win32') {
69
+ // Windows PowerShell history
70
+ const psHistoryPath = path.join(homeDir, 'AppData', 'Roaming', 'Microsoft', 'Windows', 'PowerShell', 'PSReadLine', 'ConsoleHost_history.txt');
71
+ if (fs.existsSync(psHistoryPath)) {
72
+ historyFile = psHistoryPath;
73
+ }
74
+ }
75
+ else {
76
+ // Unix-like systems (Linux, macOS)
77
+ const shell = process.env.SHELL || '';
78
+ if (shell.includes('zsh')) {
79
+ historyFile = path.join(homeDir, '.zsh_history');
80
+ }
81
+ else if (shell.includes('bash')) {
82
+ historyFile = path.join(homeDir, '.bash_history');
83
+ }
84
+ else if (shell.includes('fish')) {
85
+ historyFile = path.join(homeDir, '.local', 'share', 'fish', 'fish_history');
86
+ }
87
+ else {
88
+ // Try common locations
89
+ const possibleFiles = [
90
+ path.join(homeDir, '.zsh_history'),
91
+ path.join(homeDir, '.bash_history'),
92
+ path.join(homeDir, '.sh_history'),
93
+ path.join(homeDir, '.history')
94
+ ];
95
+ for (const file of possibleFiles) {
96
+ if (fs.existsSync(file)) {
97
+ historyFile = file;
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ }
103
+ if (!historyFile || !fs.existsSync(historyFile)) {
104
+ return null;
105
+ }
106
+ // Read the history file
107
+ const content = fs.readFileSync(historyFile, 'utf8');
108
+ const lines = content.trim().split('\n');
109
+ // Process lines from most recent to oldest
110
+ for (let i = lines.length - 1; i >= 0; i--) {
111
+ let line = lines[i].trim();
112
+ if (!line)
113
+ continue;
114
+ // Handle zsh extended history format: : timestamp:0;command
115
+ if (line.match(/^:\s*\d+:\d+;/)) {
116
+ line = line.split(';').slice(1).join(';').trim();
117
+ }
118
+ // Handle fish history format: - cmd: command
119
+ if (line.startsWith('- cmd:')) {
120
+ line = line.substring(6).trim();
121
+ }
122
+ // Skip aliasmate commands and empty lines
123
+ if (line && !line.startsWith('aliasmate') && !line.startsWith('am ')) {
124
+ return line;
125
+ }
126
+ }
127
+ return null;
128
+ }
129
+ catch (error) {
130
+ // Silent fail - return null if we can't read history
131
+ return null;
132
+ }
133
+ }
134
+ /**
135
+ * Get shell-specific configuration instructions for real-time history
136
+ */
137
+ function getHistoryConfigInstructions() {
138
+ const platform = os.platform();
139
+ const shell = process.env.SHELL || '';
140
+ if (platform === 'win32') {
141
+ return 'PowerShell writes history immediately. If using Git Bash, add to ~/.bashrc:\n' +
142
+ ' PROMPT_COMMAND="history -a"';
143
+ }
144
+ else if (shell.includes('zsh')) {
145
+ return 'Add to ~/.zshrc:\n' +
146
+ ' setopt INC_APPEND_HISTORY\n' +
147
+ 'Then run: source ~/.zshrc';
148
+ }
149
+ else if (shell.includes('bash')) {
150
+ return 'Add to ~/.bashrc:\n' +
151
+ ' PROMPT_COMMAND="history -a"\n' +
152
+ 'Then run: source ~/.bashrc';
153
+ }
154
+ else if (shell.includes('fish')) {
155
+ return 'Fish writes history immediately by default';
156
+ }
157
+ return 'Configure your shell to write history immediately.\n' +
158
+ 'For bash: Add PROMPT_COMMAND="history -a" to ~/.bashrc\n' +
159
+ 'For zsh: Add "setopt INC_APPEND_HISTORY" to ~/.zshrc';
160
+ }
161
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/utils/history.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,wCA8FC;AAKD,oEAsBC;AA1ID,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB;;;;;;;;;;;;GAYG;AACH,SAAgB,cAAc;IAC5B,IAAI,CAAC;QACH,2DAA2D;QAC3D,sEAAsE;QACtE,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;YACnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;YAClD,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;gBACxC,OAAO,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC/B,IAAI,WAAW,GAAkB,IAAI,CAAC;QAEtC,qDAAqD;QACrD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,6B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AED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,qDAAqD;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAgB,4BAA4B;IAC1C,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;IAEtC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,+EAA+E;YAC/E,+BAA+B,CAAC;IACzC,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,oBAAoB;YACpB,+BAA+B;YAC/B,2BAA2B,CAAC;IACrC,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,qBAAqB;YACrB,iCAAiC;YACjC,4BAA4B,CAAC;IACtC,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAED,OAAO,sDAAsD;QACtD,0DAA0D;QAC1D,sDAAsD,CAAC;AAChE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Resolve a path, handling relative paths, absolute paths, and special cases
3
+ * Cross-platform path resolution
4
+ */
5
+ export declare function resolvePath(inputPath: string, basePath?: string): string;
6
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAsB,GAAG,MAAM,CAqBvF"}
@@ -0,0 +1,60 @@
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.resolvePath = resolvePath;
37
+ const path = __importStar(require("path"));
38
+ /**
39
+ * Resolve a path, handling relative paths, absolute paths, and special cases
40
+ * Cross-platform path resolution
41
+ */
42
+ function resolvePath(inputPath, basePath = process.cwd()) {
43
+ if (!inputPath) {
44
+ return basePath;
45
+ }
46
+ // If it's already absolute, return it normalized
47
+ if (path.isAbsolute(inputPath)) {
48
+ return path.normalize(inputPath);
49
+ }
50
+ // Handle special cases
51
+ if (inputPath === '.') {
52
+ return basePath;
53
+ }
54
+ if (inputPath === '..') {
55
+ return path.dirname(basePath);
56
+ }
57
+ // Resolve relative to base path
58
+ return path.resolve(basePath, inputPath);
59
+ }
60
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,kCAqBC;AA3BD,2CAA6B;AAE7B;;;GAGG;AACH,SAAgB,WAAW,CAAC,SAAiB,EAAE,WAAmB,OAAO,CAAC,GAAG,EAAE;IAC7E,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,iDAAiD;IACjD,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACnC,CAAC;IAED,uBAAuB;IACvB,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;QACtB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,gCAAgC;IAChC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC"}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "aliasmate",
3
+ "version": "1.0.0",
4
+ "description": "A CLI utility to save, manage, and re-run shell commands with their working directories",
5
+ "main": "dist/cli.js",
6
+ "bin": {
7
+ "aliasmate": "./dist/cli.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "dev": "tsc --watch",
12
+ "prepublishOnly": "npm run build",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "keywords": [
16
+ "cli",
17
+ "command",
18
+ "alias",
19
+ "terminal",
20
+ "shell",
21
+ "productivity",
22
+ "command-line",
23
+ "developer-tools",
24
+ "automation",
25
+ "workflow"
26
+ ],
27
+ "author": "",
28
+ "license": "MIT",
29
+ "engines": {
30
+ "node": ">=14.0.0"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/aliasmate/aliasmate.git"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/aliasmate/aliasmate/issues"
38
+ },
39
+ "homepage": "https://github.com/aliasmate/aliasmate#readme",
40
+ "dependencies": {
41
+ "commander": "^11.1.0",
42
+ "inquirer": "^8.2.6",
43
+ "execa": "^5.1.1",
44
+ "chalk": "^4.1.2"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^20.10.0",
48
+ "@types/inquirer": "^8.2.10",
49
+ "typescript": "^5.3.3"
50
+ },
51
+ "files": [
52
+ "dist/",
53
+ "README.md",
54
+ "LICENSE",
55
+ "CHANGELOG.md"
56
+ ]
57
+ }