aliasmate 2.0.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -3
- package/README.md +98 -10
- package/dist/cli/completion.js +4 -4
- package/dist/cli/completion.js.map +1 -1
- package/dist/cli/extras.d.ts +5 -0
- package/dist/cli/extras.d.ts.map +1 -0
- package/dist/cli/extras.js +73 -0
- package/dist/cli/extras.js.map +1 -0
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +140 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/manage.d.ts +2 -3
- package/dist/cli/manage.d.ts.map +1 -1
- package/dist/cli/manage.js +47 -27
- package/dist/cli/manage.js.map +1 -1
- package/dist/cli/project.d.ts +2 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +105 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +90 -16
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/save.d.ts +7 -8
- package/dist/cli/save.d.ts.map +1 -1
- package/dist/cli/save.js +71 -33
- package/dist/cli/save.js.map +1 -1
- package/dist/cli/sync.d.ts +2 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +122 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/transfer.d.ts +1 -0
- package/dist/cli/transfer.d.ts.map +1 -1
- package/dist/cli/transfer.js +40 -59
- package/dist/cli/transfer.js.map +1 -1
- package/dist/core/clipboard.d.ts +3 -0
- package/dist/core/clipboard.d.ts.map +1 -0
- package/dist/core/clipboard.js +57 -0
- package/dist/core/clipboard.js.map +1 -0
- package/dist/core/commands.d.ts +8 -1
- package/dist/core/commands.d.ts.map +1 -1
- package/dist/core/commands.js +59 -4
- package/dist/core/commands.js.map +1 -1
- package/dist/core/project.d.ts +21 -0
- package/dist/core/project.d.ts.map +1 -0
- package/dist/core/project.js +130 -0
- package/dist/core/project.js.map +1 -0
- package/dist/core/recent.d.ts +6 -1
- package/dist/core/recent.d.ts.map +1 -1
- package/dist/core/recent.js +11 -2
- package/dist/core/recent.js.map +1 -1
- package/dist/core/runner.d.ts +22 -4
- package/dist/core/runner.d.ts.map +1 -1
- package/dist/core/runner.js +72 -8
- package/dist/core/runner.js.map +1 -1
- package/dist/core/suggest.d.ts +12 -0
- package/dist/core/suggest.d.ts.map +1 -0
- package/dist/core/suggest.js +109 -0
- package/dist/core/suggest.js.map +1 -0
- package/dist/core/transfer.d.ts +20 -0
- package/dist/core/transfer.d.ts.map +1 -0
- package/dist/core/transfer.js +115 -0
- package/dist/core/transfer.js.map +1 -0
- package/dist/core/types.d.ts +8 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/undo.d.ts +7 -0
- package/dist/core/undo.d.ts.map +1 -0
- package/dist/core/undo.js +34 -0
- package/dist/core/undo.js.map +1 -0
- package/dist/index.js +53 -15
- package/dist/index.js.map +1 -1
- package/dist/ui/format.d.ts +6 -1
- package/dist/ui/format.d.ts.map +1 -1
- package/dist/ui/format.js +64 -18
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/interactive.d.ts +63 -3
- package/dist/ui/interactive.d.ts.map +1 -1
- package/dist/ui/interactive.js +701 -95
- package/dist/ui/interactive.js.map +1 -1
- package/dist/ui/onboarding.d.ts.map +1 -1
- package/dist/ui/onboarding.js +27 -7
- package/dist/ui/onboarding.js.map +1 -1
- package/dist/ui/prompts.d.ts +1 -12
- package/dist/ui/prompts.d.ts.map +1 -1
- package/dist/ui/prompts.js +45 -91
- package/dist/ui/prompts.js.map +1 -1
- package/dist/ui/table.d.ts +18 -0
- package/dist/ui/table.d.ts.map +1 -0
- package/dist/ui/table.js +54 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/theme.d.ts +8 -6
- package/dist/ui/theme.d.ts.map +1 -1
- package/dist/ui/theme.js +33 -18
- package/dist/ui/theme.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,56 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
## [2.4.0] - 2026-07-06
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **Shell hook** (`aliasmate init install`): keeps `ALIASMATE_LAST_CMD` fresh on every prompt for instant, reliable `prev`, and logs commands to power suggestions (zsh/bash/fish)
|
|
13
|
+
- **Suggestions**: the TUI notices commands you've run 3+ times without saving and offers to save them with `a`
|
|
14
|
+
- **Run arguments**: `aliasmate run build -- --watch` appends args; `{{placeholder}}` variables in commands are prompted at run time
|
|
15
|
+
- **Chains**: `aliasmate chain ship build test deploy` — runs saved commands sequentially in their own directories, stopping on failure (⛓ in listings)
|
|
16
|
+
- **Project commands**: `.aliasmate.json` (created via `aliasmate project init/add/remove`) merges team-shared commands into everyone's list, marked ⌂; relative paths resolve against the repo root
|
|
17
|
+
- **Sync**: `aliasmate sync push/pull/set` via a private GitHub gist (uses gh CLI)
|
|
18
|
+
- **Undo**: `aliasmate undo` / `u` in the TUI reverts the last save, edit, rename, delete, or import (10-deep history)
|
|
19
|
+
- **Copy**: `aliasmate copy <name>` / `c` in the TUI copies the command to the clipboard
|
|
20
|
+
- **Notes & tags**: a note field in the TUI form, `aliasmate tag <name> <tags...>`, both searchable and shown in the detail pane
|
|
21
|
+
- **Run outcomes**: exit codes and durations recorded per run; failed commands show ✗ in the TUI list and detail pane
|
|
22
|
+
- First run seeds two deletable example commands so the TUI isn't empty
|
|
23
|
+
|
|
24
|
+
## [2.3.0] - 2026-07-06
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **In-TUI export/import**: `x` exports a full backup (real secret values) to a prefilled `~/aliasmate-backup-<date>.json` path, `i` imports from a JSON file — with inline error handling, conflict skipping, and automatic pre-import backup
|
|
28
|
+
- CLI import now asks once about conflicts instead of per command
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- Project moved to **github.com/akhshyganesh/aliasmate** (old URLs redirect); installer, docs, and package metadata updated
|
|
32
|
+
- Export/import logic extracted to `core/transfer` and shared by CLI and TUI; `~` is expanded in file paths
|
|
33
|
+
|
|
34
|
+
## [2.2.0] - 2026-07-06
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- **Rename commands**: `aliasmate rename <old> <new>` (alias `mv`), or simply change the name field in the TUI edit form — shortcut aliases and run history follow the new name
|
|
38
|
+
- **Standalone binaries** (no Node.js/npm needed): esbuild bundle + Node SEA build script, `install.sh` one-liner installer, and a GitHub Actions release workflow producing macOS (x64/arm64), Linux (x64/arm64), and Windows binaries on every tag
|
|
39
|
+
- **`export --full`**: restorable backups that keep real secret env values (default export still masks them for safe sharing)
|
|
40
|
+
- **Caret editing in TUI form fields**: ←/→, home/end (ctrl+a/ctrl+e), delete-forward, ctrl+u, and mid-string insertion
|
|
41
|
+
|
|
42
|
+
## [2.1.0] - 2026-07-06
|
|
43
|
+
|
|
44
|
+
Complete visual redesign and a real full-screen TUI.
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- **Full-screen TUI** (`aliasmate` with no args): browse commands sorted by usage with a live detail pane (command, directory, env, run history); run with `enter`, fuzzy filter with `/`, create with `n`, edit with `e`, delete with `d`, stats with `s` — everything in-screen
|
|
48
|
+
- **In-TUI forms** for creating and editing commands (name validation, path-mode toggle, env capture) — no more prompt round-trips
|
|
49
|
+
- `aliasmate prev [name]` opens the TUI form prefilled with your captured command; still saves directly when run non-interactively (scripts/CI)
|
|
50
|
+
- `aliasmate save` and `aliasmate edit <name>` open the TUI form
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
- **New design language**: terracotta accent, quiet grays, flat borderless tables, lowercase labels — content first, chrome barely visible
|
|
54
|
+
- `list`/`search` render a flat width-aware table; `stats` and `recent` restyled to match
|
|
55
|
+
- Filter matches on command names rank above matches in command text/directories
|
|
56
|
+
- Clearing a filter keeps the same row highlighted
|
|
57
|
+
- Removed the `inquirer` dependency entirely (lighter install, faster startup)
|
|
58
|
+
|
|
9
59
|
## [2.0.0] - 2026-07-06
|
|
10
60
|
|
|
11
61
|
Complete ground-up rewrite focused on performance, modularity, and day-to-day usability. Your saved commands, aliases, and run history carry over unchanged.
|
|
@@ -390,6 +440,6 @@ Complete ground-up rewrite focused on performance, modularity, and day-to-day us
|
|
|
390
440
|
- Input validation and error handling
|
|
391
441
|
- Beautiful CLI output with chalk
|
|
392
442
|
|
|
393
|
-
[1.2.0]: https://github.com/
|
|
394
|
-
[1.1.0]: https://github.com/
|
|
395
|
-
[1.0.0]: https://github.com/
|
|
443
|
+
[1.2.0]: https://github.com/akhshyganesh/aliasmate/releases/tag/v1.2.0
|
|
444
|
+
[1.1.0]: https://github.com/akhshyganesh/aliasmate/releases/tag/v1.1.0
|
|
445
|
+
[1.0.0]: https://github.com/akhshyganesh/aliasmate/releases/tag/v1.0.0
|
package/README.md
CHANGED
|
@@ -7,53 +7,132 @@ Save shell commands with their working directories and re-run them from anywhere
|
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
|
+
**Standalone (no Node.js required):**
|
|
11
|
+
|
|
10
12
|
```bash
|
|
11
|
-
|
|
13
|
+
curl -fsSL https://raw.githubusercontent.com/akhshyganesh/aliasmate/main/install.sh | sh
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
Downloads a self-contained binary for macOS (Apple Silicon) or Linux (x64/arm64). Intel Macs: use the npm install below. Windows users: grab `aliasmate-win-x64.exe` from the [latest release](https://github.com/akhshyganesh/aliasmate/releases/latest).
|
|
17
|
+
|
|
18
|
+
**Via npm** (requires Node.js 18+):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm i -g aliasmate
|
|
22
|
+
```
|
|
15
23
|
|
|
16
24
|
## Quick start
|
|
17
25
|
|
|
18
26
|
```bash
|
|
19
|
-
# Run any command, then
|
|
27
|
+
# Run any command, then capture it — the TUI opens with everything prefilled
|
|
20
28
|
npm run build -- --production
|
|
21
29
|
aliasmate prev build
|
|
22
30
|
|
|
23
31
|
# Run it later, from any directory — it executes back in the project folder
|
|
24
32
|
aliasmate run build
|
|
25
33
|
|
|
26
|
-
# Or
|
|
34
|
+
# Or open the full-screen TUI
|
|
27
35
|
aliasmate
|
|
28
36
|
```
|
|
29
37
|
|
|
30
|
-
Running `aliasmate` with no arguments opens
|
|
38
|
+
Running `aliasmate` with no arguments opens a full-screen TUI: your commands sorted by usage with a live detail pane. Everything happens in-screen:
|
|
39
|
+
|
|
40
|
+
| Key | Action |
|
|
41
|
+
|-----|--------|
|
|
42
|
+
| `↑↓` / `jk` | move |
|
|
43
|
+
| `enter` | run selected command |
|
|
44
|
+
| `/` | fuzzy filter (type to narrow) |
|
|
45
|
+
| `n` | new command (in-TUI form) |
|
|
46
|
+
| `e` | edit selected (in-TUI form) |
|
|
47
|
+
| `d` | delete (with confirm) |
|
|
48
|
+
| `←→` | move the caret while editing form fields |
|
|
49
|
+
| `c` | copy the selected command to the clipboard |
|
|
50
|
+
| `u` | undo the last change |
|
|
51
|
+
| `a` | save the command you keep repeating (suggested automatically) |
|
|
52
|
+
| `s` | usage stats |
|
|
53
|
+
| `x` | export a full backup (JSON) |
|
|
54
|
+
| `i` | import commands from a JSON file |
|
|
55
|
+
| `q` / `esc` | quit |
|
|
31
56
|
|
|
32
57
|
## Commands
|
|
33
58
|
|
|
34
59
|
| Command | Description |
|
|
35
60
|
|---------|-------------|
|
|
36
|
-
| `aliasmate` |
|
|
37
|
-
| `aliasmate prev
|
|
38
|
-
| `aliasmate save` |
|
|
61
|
+
| `aliasmate` | Full-screen TUI (browse/run/create/edit/delete/stats) |
|
|
62
|
+
| `aliasmate prev [name]` | Capture your last shell command → TUI form, prefilled (saves directly when scripted) |
|
|
63
|
+
| `aliasmate save` | Open the TUI with a blank new-command form |
|
|
39
64
|
| `aliasmate run <name> [path]` | Run a saved command, optionally in a different directory |
|
|
65
|
+
| `aliasmate run <name> -- <args>` | Append extra arguments to the saved command |
|
|
66
|
+
| `aliasmate copy <name>` | Copy a command to the clipboard |
|
|
67
|
+
| `aliasmate undo` | Revert the last save/edit/rename/delete/import |
|
|
68
|
+
| `aliasmate chain <name> <steps...>` | Save a chain that runs commands in sequence |
|
|
69
|
+
| `aliasmate tag <name> [tags...]` | Tag commands for search (`-` clears) |
|
|
70
|
+
| `aliasmate init install` | Install the shell hook (reliable capture + suggestions) |
|
|
71
|
+
| `aliasmate project init/add/remove` | Share commands with your team via `.aliasmate.json` |
|
|
72
|
+
| `aliasmate sync push/pull` | Sync commands across machines via a private gist (gh CLI) |
|
|
40
73
|
| `aliasmate run @0` | Re-run your most recent command (`@1`, `@2`, …) |
|
|
41
74
|
| `aliasmate run <name> --dry-run [--verbose]` | Preview without executing |
|
|
42
75
|
| `aliasmate list` (`ls`) | List commands (`--format table\|json\|yaml\|compact`) |
|
|
43
76
|
| `aliasmate search <query>` (`find`) | Search by name, text, or directory |
|
|
44
|
-
| `aliasmate edit <name>` | Edit a command (
|
|
77
|
+
| `aliasmate edit <name>` | Edit a command in the TUI form (change the name field to rename) |
|
|
78
|
+
| `aliasmate rename <old> <new>` (`mv`) | Rename a command — aliases and run history follow |
|
|
45
79
|
| `aliasmate delete <name>` (`rm`) | Delete a command (`-f` skips confirmation) |
|
|
46
80
|
| `aliasmate alias <short> <name>` | Create a shortcut alias (`--list`, `--remove <a>`) |
|
|
47
81
|
| `aliasmate recent` | Recently run commands with `@N` indices (`--clear`) |
|
|
48
82
|
| `aliasmate stats` | Usage statistics: most-used commands, total runs |
|
|
49
83
|
| `aliasmate validate [name]` | Check commands, directories, and env vars |
|
|
50
|
-
| `aliasmate export <file>` | Export to JSON/YAML — secrets masked |
|
|
84
|
+
| `aliasmate export <file>` | Export to JSON/YAML — secrets masked for sharing |
|
|
85
|
+
| `aliasmate export <file> --full` | Restorable backup with real secret values |
|
|
51
86
|
| `aliasmate import <file>` | Import from JSON (backs up your config first) |
|
|
52
87
|
| `aliasmate completion install` | Install tab completion (bash/zsh/fish) |
|
|
53
88
|
| `aliasmate config` | Show where your data is stored |
|
|
54
89
|
|
|
55
90
|
## Key features
|
|
56
91
|
|
|
92
|
+
### Shell hook (recommended)
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
aliasmate init install # zsh, bash, or fish
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The hook keeps your last command instantly available to `aliasmate prev` (no history-file lag) and powers suggestions: when you've typed the same command three times without saving it, the TUI offers to save it with one keypress (`a`).
|
|
99
|
+
|
|
100
|
+
### Placeholders & arguments
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# {{placeholders}} are prompted at run time
|
|
104
|
+
aliasmate save # command: git checkout {{branch}}
|
|
105
|
+
aliasmate run co # ? branch ▸ main
|
|
106
|
+
|
|
107
|
+
# or append args ad hoc
|
|
108
|
+
aliasmate run build -- --watch
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Chains
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
aliasmate chain ship build test deploy
|
|
115
|
+
aliasmate run ship # runs each in its own directory, stops on failure
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Project commands
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
aliasmate project init # creates .aliasmate.json — commit it
|
|
122
|
+
aliasmate project add build # copy a saved command into the project
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Inside that repo, everyone with aliasmate sees the project's commands (marked ⌂ in the TUI) merged with their own.
|
|
126
|
+
|
|
127
|
+
### Sync across machines
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
aliasmate sync push # creates/updates a private GitHub gist (needs gh)
|
|
131
|
+
aliasmate sync set <id> # on another machine
|
|
132
|
+
aliasmate sync pull
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
|
|
57
136
|
### Path modes
|
|
58
137
|
Each command runs either in its **saved directory** (project commands like `build`) or in your **current directory** (general utilities like `lint`). Choose when saving; change anytime with `edit`.
|
|
59
138
|
|
|
@@ -66,6 +145,15 @@ When saving, you can capture user-defined env vars (`NODE_ENV`, `API_URL`, …)
|
|
|
66
145
|
- All writes to your config are atomic; a crash can never corrupt your data.
|
|
67
146
|
- `import` writes a timestamped backup of your existing config before touching it.
|
|
68
147
|
|
|
148
|
+
### Backup & restore
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
aliasmate export backup.json --full # everything, including real env secrets
|
|
152
|
+
aliasmate import backup.json # restore (auto-backs up current state first)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Default exports mask secret values so they're safe to share with a team; `--full` keeps them intact for personal backups.
|
|
156
|
+
|
|
69
157
|
### Recent commands & stats
|
|
70
158
|
Every run is tracked. `aliasmate run @0` re-runs your latest command, `aliasmate recent` lists history, and `aliasmate stats` shows your most-used commands.
|
|
71
159
|
|
package/dist/cli/completion.js
CHANGED
|
@@ -39,7 +39,7 @@ const os = __importStar(require("os"));
|
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
40
|
const commands_1 = require("../core/commands");
|
|
41
41
|
const theme_1 = require("../ui/theme");
|
|
42
|
-
const SUBCOMMANDS = 'run save prev list search edit delete export import alias recent validate stats completion config help';
|
|
42
|
+
const SUBCOMMANDS = 'run save prev list search edit rename delete export import alias recent validate stats copy undo chain tag init project sync completion config help';
|
|
43
43
|
function savedNames() {
|
|
44
44
|
return [...Object.keys((0, commands_1.listCommands)()), ...Object.keys((0, commands_1.listAliases)())].join(' ');
|
|
45
45
|
}
|
|
@@ -51,7 +51,7 @@ _aliasmate_complete() {
|
|
|
51
51
|
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
52
52
|
if [ "$COMP_CWORD" -eq 1 ]; then
|
|
53
53
|
COMPREPLY=( $(compgen -W "${SUBCOMMANDS}" -- "$cur") )
|
|
54
|
-
elif [ "$prev" = "run" ] || [ "$prev" = "edit" ] || [ "$prev" = "delete" ] || [ "$prev" = "rm" ] || [ "$prev" = "validate" ]; then
|
|
54
|
+
elif [ "$prev" = "run" ] || [ "$prev" = "edit" ] || [ "$prev" = "rename" ] || [ "$prev" = "mv" ] || [ "$prev" = "delete" ] || [ "$prev" = "rm" ] || [ "$prev" = "validate" ] || [ "$prev" = "copy" ] || [ "$prev" = "tag" ]; then
|
|
55
55
|
COMPREPLY=( $(compgen -W "$(aliasmate completion --names 2>/dev/null)" -- "$cur") )
|
|
56
56
|
fi
|
|
57
57
|
}
|
|
@@ -65,7 +65,7 @@ _aliasmate() {
|
|
|
65
65
|
subcmds=(${SUBCOMMANDS})
|
|
66
66
|
if (( CURRENT == 2 )); then
|
|
67
67
|
_describe 'command' subcmds
|
|
68
|
-
elif [[ \${words[2]} == (run|edit|delete|rm|validate) ]]; then
|
|
68
|
+
elif [[ \${words[2]} == (run|edit|rename|mv|delete|rm|validate|copy|tag) ]]; then
|
|
69
69
|
local -a names
|
|
70
70
|
names=($(aliasmate completion --names 2>/dev/null))
|
|
71
71
|
_describe 'saved command' names
|
|
@@ -78,7 +78,7 @@ function fishScript() {
|
|
|
78
78
|
return `# aliasmate fish completion
|
|
79
79
|
complete -c aliasmate -f
|
|
80
80
|
complete -c aliasmate -n "__fish_use_subcommand" -a "${SUBCOMMANDS}"
|
|
81
|
-
complete -c aliasmate -n "__fish_seen_subcommand_from run edit delete rm validate" -a "(aliasmate completion --names 2>/dev/null)"
|
|
81
|
+
complete -c aliasmate -n "__fish_seen_subcommand_from run edit rename mv delete rm validate copy tag" -a "(aliasmate completion --names 2>/dev/null)"
|
|
82
82
|
`;
|
|
83
83
|
}
|
|
84
84
|
function detectShell() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/cli/completion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;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E,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IACD,IAAA,YAAI,EACF,+FAA+F,CAChG,CAAC;IACF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,SAAgB,iBAAiB,CAC/B,KAAyB,EACzB,OAA+C;IAE/C,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1B,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC3C,iBAAiB,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IACD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1B,MAAM;QACR,KAAK,KAAK;YACR,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;YACzB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1B,MAAM;QACR;YACE,IAAA,YAAI,EAAC,6EAA6E,CAAC,CAAC;YACpF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function copyHandler(nameInput: string): void;
|
|
2
|
+
export declare function undoHandler(): void;
|
|
3
|
+
export declare function chainHandler(name: string, steps: string[]): void;
|
|
4
|
+
export declare function tagHandler(name: string, tags: string[]): void;
|
|
5
|
+
//# sourceMappingURL=extras.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extras.d.ts","sourceRoot":"","sources":["../../src/cli/extras.ts"],"names":[],"mappings":"AAYA,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAcnD;AAED,wBAAgB,WAAW,IAAI,IAAI,CAQlC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAgBhE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAoB7D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyHandler = copyHandler;
|
|
4
|
+
exports.undoHandler = undoHandler;
|
|
5
|
+
exports.chainHandler = chainHandler;
|
|
6
|
+
exports.tagHandler = tagHandler;
|
|
7
|
+
const commands_1 = require("../core/commands");
|
|
8
|
+
const clipboard_1 = require("../core/clipboard");
|
|
9
|
+
const undo_1 = require("../core/undo");
|
|
10
|
+
const recent_1 = require("../core/recent");
|
|
11
|
+
const theme_1 = require("../ui/theme");
|
|
12
|
+
function copyHandler(nameInput) {
|
|
13
|
+
const name = (0, commands_1.resolveName)(nameInput, (0, recent_1.getRecentNames)());
|
|
14
|
+
const cmd = name ? (0, commands_1.getCommand)(name) : undefined;
|
|
15
|
+
if (!name || !cmd) {
|
|
16
|
+
(0, theme_1.fail)(`Command "${nameInput}" not found`);
|
|
17
|
+
process.exitCode = 1;
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if ((0, clipboard_1.copyToClipboard)(cmd.command)) {
|
|
21
|
+
(0, theme_1.ok)(`copied ${theme_1.theme.name(name)} ${theme_1.theme.dim(`· ${cmd.command}`)}`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
// No clipboard tool available — print it so it can still be grabbed.
|
|
25
|
+
console.log(cmd.command);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function undoHandler() {
|
|
29
|
+
const label = (0, undo_1.undoLast)();
|
|
30
|
+
if (!label) {
|
|
31
|
+
(0, theme_1.fail)('Nothing to undo');
|
|
32
|
+
process.exitCode = 1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
(0, theme_1.ok)(`undid ${theme_1.theme.name(label)}`);
|
|
36
|
+
}
|
|
37
|
+
function chainHandler(name, steps) {
|
|
38
|
+
const nameCheck = (0, commands_1.validateCommandName)(name);
|
|
39
|
+
if (nameCheck !== true)
|
|
40
|
+
throw new Error(nameCheck);
|
|
41
|
+
const missing = steps.filter((s) => !(0, commands_1.commandExists)(s));
|
|
42
|
+
if (missing.length > 0) {
|
|
43
|
+
throw new Error(`Unknown command${missing.length > 1 ? 's' : ''}: ${missing.join(', ')}`);
|
|
44
|
+
}
|
|
45
|
+
if (steps.includes(name))
|
|
46
|
+
throw new Error('A chain cannot include itself');
|
|
47
|
+
(0, commands_1.saveCommand)({
|
|
48
|
+
name,
|
|
49
|
+
command: `chain: ${steps.join(' → ')}`,
|
|
50
|
+
directory: process.cwd(),
|
|
51
|
+
pathMode: 'current',
|
|
52
|
+
steps,
|
|
53
|
+
});
|
|
54
|
+
(0, theme_1.ok)(`saved chain ${theme_1.theme.name(name)} ${theme_1.theme.dim(`· ${steps.join(' → ')}`)}`);
|
|
55
|
+
}
|
|
56
|
+
function tagHandler(name, tags) {
|
|
57
|
+
const cmd = (0, commands_1.getCommand)(name);
|
|
58
|
+
if (!cmd) {
|
|
59
|
+
(0, theme_1.fail)(`Command "${name}" not found`);
|
|
60
|
+
process.exitCode = 1;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (tags.length === 0) {
|
|
64
|
+
console.log(cmd.tags?.length ? cmd.tags.map((t) => theme_1.theme.accent(`#${t}`)).join(' ') : theme_1.theme.dim('no tags'));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const cleared = tags.length === 1 && tags[0] === '-';
|
|
68
|
+
(0, commands_1.saveCommand)({ name, ...cmd, tags: cleared ? [] : tags });
|
|
69
|
+
(0, theme_1.ok)(cleared
|
|
70
|
+
? `cleared tags on ${theme_1.theme.name(name)}`
|
|
71
|
+
: `tagged ${theme_1.theme.name(name)} ${tags.map((t) => theme_1.theme.accent(`#${t}`)).join(' ')}`);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=extras.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extras.js","sourceRoot":"","sources":["../../src/cli/extras.ts"],"names":[],"mappings":";;AAYA,kCAcC;AAED,kCAQC;AAED,oCAgBC;AAED,gCAoBC;AA5ED,+CAM0B;AAC1B,iDAAoD;AACpD,uCAAwC;AACxC,2CAAgD;AAChD,uCAA8C;AAE9C,SAAgB,WAAW,CAAC,SAAiB;IAC3C,MAAM,IAAI,GAAG,IAAA,sBAAW,EAAC,SAAS,EAAE,IAAA,uBAAc,GAAE,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChD,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QAClB,IAAA,YAAI,EAAC,YAAY,SAAS,aAAa,CAAC,CAAC;QACzC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IACD,IAAI,IAAA,2BAAe,EAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,IAAA,UAAE,EAAC,UAAU,aAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,aAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,qEAAqE;QACrE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAgB,WAAW;IACzB,MAAM,KAAK,GAAG,IAAA,eAAQ,GAAE,CAAC;IACzB,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,IAAA,YAAI,EAAC,iBAAiB,CAAC,CAAC;QACx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ot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAsFA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAmB3D"}
|
package/dist/cli/init.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
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.initHandler = initHandler;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const theme_1 = require("../ui/theme");
|
|
41
|
+
/**
|
|
42
|
+
* Shell hooks keep ALIASMATE_LAST_CMD fresh on every prompt (making `prev`
|
|
43
|
+
* instant and reliable) and append each command to a raw log that powers
|
|
44
|
+
* "you keep running this — save it?" suggestions.
|
|
45
|
+
*/
|
|
46
|
+
function zshHook() {
|
|
47
|
+
return `# aliasmate shell hook
|
|
48
|
+
_aliasmate_hook() {
|
|
49
|
+
local last="$(fc -ln -1 2>/dev/null | sed 's/^[[:space:]]*//')"
|
|
50
|
+
[ -n "$last" ] || return 0
|
|
51
|
+
export ALIASMATE_LAST_CMD="$last"
|
|
52
|
+
print -r -- "$last" >> "\${ALIASMATE_HOME:-$HOME/.config/aliasmate}/raw.log" 2>/dev/null || true
|
|
53
|
+
}
|
|
54
|
+
typeset -ag precmd_functions
|
|
55
|
+
if [[ -z "\${precmd_functions[(r)_aliasmate_hook]}" ]]; then
|
|
56
|
+
precmd_functions+=(_aliasmate_hook)
|
|
57
|
+
fi
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
function bashHook() {
|
|
61
|
+
return `# aliasmate shell hook
|
|
62
|
+
_aliasmate_hook() {
|
|
63
|
+
local last="$(HISTTIMEFORMAT= builtin history 1 2>/dev/null | sed 's/^ *[0-9]* *//')"
|
|
64
|
+
[ -n "$last" ] || return 0
|
|
65
|
+
export ALIASMATE_LAST_CMD="$last"
|
|
66
|
+
printf '%s\\n' "$last" >> "\${ALIASMATE_HOME:-$HOME/.config/aliasmate}/raw.log" 2>/dev/null || true
|
|
67
|
+
}
|
|
68
|
+
case ";$PROMPT_COMMAND;" in
|
|
69
|
+
*";_aliasmate_hook;"*) ;;
|
|
70
|
+
*) PROMPT_COMMAND="_aliasmate_hook\${PROMPT_COMMAND:+;$PROMPT_COMMAND}" ;;
|
|
71
|
+
esac
|
|
72
|
+
`;
|
|
73
|
+
}
|
|
74
|
+
function fishHook() {
|
|
75
|
+
return `# aliasmate shell hook
|
|
76
|
+
function _aliasmate_hook --on-event fish_postexec
|
|
77
|
+
set -gx ALIASMATE_LAST_CMD $argv[1]
|
|
78
|
+
set -l dir "$ALIASMATE_HOME"
|
|
79
|
+
test -n "$dir"; or set dir "$HOME/.config/aliasmate"
|
|
80
|
+
echo $argv[1] >> "$dir/raw.log" 2>/dev/null
|
|
81
|
+
end
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
function detectShell() {
|
|
85
|
+
const shell = process.env.SHELL ?? '';
|
|
86
|
+
if (shell.includes('zsh'))
|
|
87
|
+
return 'zsh';
|
|
88
|
+
if (shell.includes('bash'))
|
|
89
|
+
return 'bash';
|
|
90
|
+
if (shell.includes('fish'))
|
|
91
|
+
return 'fish';
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function installHook() {
|
|
95
|
+
const shell = detectShell();
|
|
96
|
+
const home = os.homedir();
|
|
97
|
+
if (shell === 'fish') {
|
|
98
|
+
const dir = path.join(home, '.config', 'fish', 'conf.d');
|
|
99
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
100
|
+
fs.writeFileSync(path.join(dir, 'aliasmate.fish'), fishHook(), 'utf8');
|
|
101
|
+
(0, theme_1.ok)('Hook installed for fish. It loads automatically in new shells.');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (shell === 'bash' || shell === 'zsh') {
|
|
105
|
+
const rc = path.join(home, shell === 'zsh' ? '.zshrc' : '.bashrc');
|
|
106
|
+
const line = `eval "$(aliasmate init ${shell})"`;
|
|
107
|
+
const existing = fs.existsSync(rc) ? fs.readFileSync(rc, 'utf8') : '';
|
|
108
|
+
if (existing.includes(line)) {
|
|
109
|
+
(0, theme_1.ok)('Hook is already installed.');
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
fs.appendFileSync(rc, `\n# aliasmate shell hook\n${line}\n`, 'utf8');
|
|
113
|
+
(0, theme_1.ok)(`Hook added to ${rc}`);
|
|
114
|
+
console.log(theme_1.theme.dim(` Reload with: source ${rc}`));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
(0, theme_1.fail)('Could not detect your shell. Print a hook manually: aliasmate init <bash|zsh|fish>');
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
}
|
|
120
|
+
function initHandler(shell) {
|
|
121
|
+
switch (shell) {
|
|
122
|
+
case 'zsh':
|
|
123
|
+
console.log(zshHook());
|
|
124
|
+
break;
|
|
125
|
+
case 'bash':
|
|
126
|
+
console.log(bashHook());
|
|
127
|
+
break;
|
|
128
|
+
case 'fish':
|
|
129
|
+
console.log(fishHook());
|
|
130
|
+
break;
|
|
131
|
+
case 'install':
|
|
132
|
+
case undefined:
|
|
133
|
+
installHook();
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
(0, theme_1.fail)('Usage: aliasmate init <bash|zsh|fish> or aliasmate init install');
|
|
137
|
+
process.exitCode = 1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,kCAmBC;AAzGD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,uCAA8C;AAE9C;;;;GAIG;AACH,SAAS,OAAO;IACd,OAAO;;;;;;;;;;;CAWR,CAAC;AACF,CAAC;AAED,SAAS,QAAQ;IACf,OAAO;;;;;;;;;;;CAWR,CAAC;AACF,CAAC;AAED,SAAS,QAAQ;IACf,OAAO;;;;;;;CAOR,CAAC;AACF,CAAC;AAED,SAAS,WAAW;I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AE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,IAAA,UAAE,EAAC,4BAA4B,CAAC,CAAC;YACjC,OAAO;QACT,CAAC;QACD,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,6BAA6B,IAAI,IAAI,EAAE,MAAM,CAAC,CAAC;QACrE,IAAA,UAAE,EAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,aAAK,CAAC,GAAG,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IACD,IAAA,YAAI,EAAC,oFAAoF,CAAC,CAAC;IAC3F,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,SAAgB,WAAW,CAAC,KAAyB;IACnD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,KAAK;YACR,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACvB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxB,MAAM;QACR,KAAK,SAAS,CAAC;QACf,KAAK,SAAS;YACZ,WAAW,EAAE,CAAC;YACd,MAAM;QACR;YACE,IAAA,YAAI,EAAC,iEAAiE,CAAC,CAAC;YACxE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACH,CAAC"}
|
package/dist/cli/manage.d.ts
CHANGED
|
@@ -4,9 +4,8 @@ export declare function searchHandler(query: string): void;
|
|
|
4
4
|
export declare function deleteHandler(name: string, options: {
|
|
5
5
|
force?: boolean;
|
|
6
6
|
}): Promise<void>;
|
|
7
|
-
export declare function editHandler(name: string
|
|
8
|
-
|
|
9
|
-
}): Promise<void>;
|
|
7
|
+
export declare function editHandler(name: string): Promise<void>;
|
|
8
|
+
export declare function renameHandler(from: string, to: string): Promise<void>;
|
|
10
9
|
export declare function aliasHandler(shortAlias: string | undefined, commandName: string | undefined, options: {
|
|
11
10
|
list?: boolean;
|
|
12
11
|
remove?: string;
|
package/dist/cli/manage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manage.d.ts","sourceRoot":"","sources":["../../src/cli/manage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"manage.d.ts","sourceRoot":"","sources":["../../src/cli/manage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;AAuBvD,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAmBpD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASjD;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7F;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB7D;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI3E;AAED,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,IAAI,CAsBN;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CA+BhF;AAED,wBAAgB,YAAY,IAAI,IAAI,CAmBnC;AAED,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CA6BnD"}
|