@seanmozeik/avicon 0.1.3
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/README.md +207 -0
- package/package.json +49 -0
- package/src/index.ts +781 -0
- package/src/lib/ai.ts +145 -0
- package/src/lib/clipboard.ts +40 -0
- package/src/lib/config.ts +83 -0
- package/src/lib/multi.ts +49 -0
- package/src/lib/prompt.ts +102 -0
- package/src/lib/run.ts +35 -0
- package/src/lib/secrets.ts +2 -0
- package/src/lib/tools.ts +112 -0
- package/src/types.ts +30 -0
- package/src/ui/banner.ts +24 -0
- package/src/ui/theme.ts +162 -0
package/README.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# avicon
|
|
2
|
+
|
|
3
|
+
**A**udio **V**ideo **I**mage **Con**verter — describe what you want, get the shell commands.
|
|
4
|
+
|
|
5
|
+
Avicon is a CLI that turns plain-English media requests into executable FFmpeg and ImageMagick commands. It detects your installed tools and their capabilities, sends your request to an AI provider, and presents the generated commands for review before running them.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
avicon "convert video.mp4 to gif at 15fps"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
╭──────────── What this does ────────────╮
|
|
13
|
+
│ │
|
|
14
|
+
│ Converts your MP4 to an animated GIF │
|
|
15
|
+
│ at 15 frames per second. │
|
|
16
|
+
│ │
|
|
17
|
+
╰────────────────────────────────────────╯
|
|
18
|
+
|
|
19
|
+
╭ Commands ──────────────────────────────╮
|
|
20
|
+
│ [1] ffmpeg -i video.mp4 -vf "fps=15, │
|
|
21
|
+
│ scale=480:-1" video_converted.gif │
|
|
22
|
+
╰────────────────────────────────────────╯
|
|
23
|
+
|
|
24
|
+
◆ What would you like to do?
|
|
25
|
+
│ ● Run all
|
|
26
|
+
│ ○ Edit commands
|
|
27
|
+
│ ○ Retry
|
|
28
|
+
│ ○ Edit prompt
|
|
29
|
+
│ ○ Copy
|
|
30
|
+
│ ○ Cancel
|
|
31
|
+
└
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
Requires [Bun](https://bun.sh).
|
|
37
|
+
|
|
38
|
+
**Homebrew:**
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
brew install seanmozeik/tap/avicon
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**npm:**
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
bun add -g @seanmozeik/avicon
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**From source:**
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/seanmozeik/avicon.git
|
|
54
|
+
cd avicon
|
|
55
|
+
bun install
|
|
56
|
+
bun run build # compiled binary → ./avicon
|
|
57
|
+
bun run install-local # moves binary to ~/.local/bin
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Setup
|
|
61
|
+
|
|
62
|
+
Run `avicon setup` to configure your AI provider.
|
|
63
|
+
|
|
64
|
+
**Cloudflare AI** requires an account ID and API token. Credentials are stored in your system keychain (macOS Keychain, Linux libsecret).
|
|
65
|
+
|
|
66
|
+
**Claude Code CLI** requires the `claude` binary on your PATH. No additional credentials needed.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
avicon setup
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
◆ Which AI provider?
|
|
74
|
+
│ ● Cloudflare AI (requires Account ID + API token)
|
|
75
|
+
│ ○ Claude Code CLI (requires claude CLI installed)
|
|
76
|
+
└
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For headless or CI environments, set the `AVICON_CONFIG` environment variable:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
export AVICON_CONFIG='{"defaultProvider":"cloudflare","cloudflare":{"accountId":"...","apiToken":"..."}}'
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Linux users need libsecret for keychain storage:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Ubuntu/Debian
|
|
89
|
+
sudo apt install libsecret-1-0 libsecret-tools
|
|
90
|
+
|
|
91
|
+
# Fedora
|
|
92
|
+
sudo dnf install libsecret
|
|
93
|
+
|
|
94
|
+
# Arch
|
|
95
|
+
sudo pacman -S libsecret
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Usage
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
avicon "<your request>"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Avicon detects FFmpeg and ImageMagick on startup, inventories their codecs, filters, and supported formats, and feeds this context to the AI. The generated commands match your actual environment.
|
|
105
|
+
|
|
106
|
+
### Examples
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Video
|
|
110
|
+
avicon "convert video.mp4 to gif at 15fps"
|
|
111
|
+
avicon "extract audio from interview.mov as flac"
|
|
112
|
+
avicon "compress this 4K video to 1080p h265 with good quality"
|
|
113
|
+
|
|
114
|
+
# Images
|
|
115
|
+
avicon "resize all jpgs in this folder to 800px wide"
|
|
116
|
+
avicon "convert logo.png to webp and avif"
|
|
117
|
+
avicon "strip EXIF data from every image in ./photos"
|
|
118
|
+
|
|
119
|
+
# Audio
|
|
120
|
+
avicon "split podcast.mp3 into 30-minute chunks"
|
|
121
|
+
avicon "normalize volume across all wav files here"
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Actions
|
|
125
|
+
|
|
126
|
+
After generation, you choose what happens next:
|
|
127
|
+
|
|
128
|
+
| Action | Effect |
|
|
129
|
+
|---|---|
|
|
130
|
+
| **Run all** | Executes each command in sequence with live terminal output |
|
|
131
|
+
| **Edit commands** | Opens the commands in a text editor for manual tweaks |
|
|
132
|
+
| **Retry** | Regenerates with the same prompt |
|
|
133
|
+
| **Edit prompt** | Modifies your request and regenerates |
|
|
134
|
+
| **Copy** | Copies all commands to clipboard |
|
|
135
|
+
| **Cancel** | Exits |
|
|
136
|
+
|
|
137
|
+
### Provider override
|
|
138
|
+
|
|
139
|
+
Force a specific provider for one invocation:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
avicon "resize photo.jpg to 50%" --provider claude
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Post-run cleanup
|
|
146
|
+
|
|
147
|
+
After commands finish, avicon scans for media files referenced in the commands and offers to delete the originals. The default is No.
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
ℹ Input files detected:
|
|
151
|
+
video.mp4
|
|
152
|
+
◆ Delete original files?
|
|
153
|
+
│ ○ Yes / ● No
|
|
154
|
+
└
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Error recovery
|
|
158
|
+
|
|
159
|
+
If the AI returns an unparseable response, avicon shows the raw output and offers three paths: retry with the same prompt, edit your prompt and retry, or cancel. This loop continues until you get a valid result or walk away.
|
|
160
|
+
|
|
161
|
+
## Flags
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
--provider cloudflare|claude Override the default provider
|
|
165
|
+
--help, -h Show usage and examples
|
|
166
|
+
--version, -v Print version
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Subcommands
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
setup Configure AI provider credentials
|
|
173
|
+
teardown Remove saved credentials from keychain
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Tool detection
|
|
177
|
+
|
|
178
|
+
On each run, avicon probes for:
|
|
179
|
+
|
|
180
|
+
- **FFmpeg**: version, codecs, filters, bitstream filters, formats
|
|
181
|
+
- **ImageMagick**: version, supported format list
|
|
182
|
+
|
|
183
|
+
This context goes into the system prompt so the AI only generates commands your system can execute. If a tool is missing, avicon warns you and the AI works around it.
|
|
184
|
+
|
|
185
|
+
## How it works
|
|
186
|
+
|
|
187
|
+
1. Parse your request and detect installed tools
|
|
188
|
+
2. Build a system prompt containing tool versions, codecs, and formats
|
|
189
|
+
3. Send the request to Cloudflare AI or Claude Code CLI
|
|
190
|
+
4. Parse the JSON response into commands and a plain-English explanation
|
|
191
|
+
5. Display both in separate panels for review
|
|
192
|
+
6. Execute, edit, retry, copy, or cancel
|
|
193
|
+
|
|
194
|
+
Generated commands use safe defaults: output files get a `_converted` suffix, existing files are never overwritten silently.
|
|
195
|
+
|
|
196
|
+
## Development
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
bun install
|
|
200
|
+
bun --hot src/index.ts # dev mode with hot reload
|
|
201
|
+
bun test # run tests
|
|
202
|
+
bun run build # compile to standalone binary
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seanmozeik/avicon",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "AI-powered audio/video/image conversion CLI — describe what you want, get the commands",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"avicon": "src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"package.json"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"media",
|
|
15
|
+
"conversion",
|
|
16
|
+
"ffmpeg",
|
|
17
|
+
"imagemagick",
|
|
18
|
+
"cli",
|
|
19
|
+
"ai",
|
|
20
|
+
"bun"
|
|
21
|
+
],
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/seanmozeik/avicon.git"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@clack/prompts": "latest",
|
|
32
|
+
"boxen": "latest",
|
|
33
|
+
"gradient-string": "latest",
|
|
34
|
+
"picocolors": "latest"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/bun": "latest"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"typescript": "^5"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "bun build ./src/index.ts --compile --outfile avicon --minify",
|
|
44
|
+
"bundle": "bun build ./src/index.ts --outdir dist --target=bun --bytecode --minify",
|
|
45
|
+
"dev": "bun --hot src/index.ts",
|
|
46
|
+
"install-local": "bun run build && mkdir -p ~/.local/bin && mv avicon ~/.local/bin/avicon && chmod +x ~/.local/bin/avicon",
|
|
47
|
+
"test": "bun test"
|
|
48
|
+
}
|
|
49
|
+
}
|