qasai 0.0.1 → 0.0.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/.github/image.png +0 -0
- package/AGENTS.md +15 -0
- package/CHANGELOG.md +13 -0
- package/README.md +16 -3
- package/docs/spec.md +114 -0
- package/package.json +1 -1
- package/skills/SKILL.md +179 -0
- package/skills/spec.md +114 -0
|
Binary file
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Memory
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
See @README.md for project overview and @package.json for available npm/pnpm commands for this project.
|
|
5
|
+
|
|
6
|
+
## Code Style Guidelines
|
|
7
|
+
- Use descriptive variable names
|
|
8
|
+
- Follow existing patterns in the codebase
|
|
9
|
+
- Extract complex conditions into meaningful boolean variables
|
|
10
|
+
|
|
11
|
+
## Architecture Notes
|
|
12
|
+
Add important architectural decisions and patterns here.
|
|
13
|
+
|
|
14
|
+
## Common Workflows
|
|
15
|
+
Document frequently used workflows and commands here.
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.0.3] - 2026-01-24
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- AI agent skill for `npx skills ahmadawais/qasai` installation
|
|
10
|
+
- Skills directory with SKILL.md and spec.md for agent usage
|
|
11
|
+
|
|
12
|
+
## [0.0.2] - 2026-01-24
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Image path fix
|
|
17
|
+
|
|
5
18
|
## [0.0.1] - 2026-01-24
|
|
6
19
|
|
|
7
20
|
### Added
|
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# QASAI
|
|
2
4
|
|
|
3
5
|
A powerful image compression CLI with multiple engine support, lossless/lossy options, and both interactive and non-interactive modes.
|
|
4
6
|
|
|
7
|
+
📖 **[Full Specification](./docs/spec.md)**
|
|
8
|
+
|
|
5
9
|
## Features
|
|
6
10
|
|
|
7
11
|
- **Multiple compression engines** - Choose the best tool for each format
|
|
@@ -14,8 +18,17 @@ A powerful image compression CLI with multiple engine support, lossless/lossy op
|
|
|
14
18
|
## Installation
|
|
15
19
|
|
|
16
20
|
```bash
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
npm install -g qasai
|
|
22
|
+
# or
|
|
23
|
+
npx qasai
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### AI Agent Skill
|
|
27
|
+
|
|
28
|
+
Install as an AI agent skill:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx skills ahmadawais/qasai
|
|
19
32
|
```
|
|
20
33
|
|
|
21
34
|
## Usage
|
|
@@ -287,4 +300,4 @@ qasai compress ./images -f avif -q 70
|
|
|
287
300
|
|
|
288
301
|
## License
|
|
289
302
|
|
|
290
|
-
|
|
303
|
+
Apache 2.0 by [Ahmad Awais](https://x.com/MrAhmadAwais)
|
package/docs/spec.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# QASAI Specification
|
|
2
|
+
|
|
3
|
+
Image compression CLI with lossless and lossy options.
|
|
4
|
+
|
|
5
|
+
## Supported Formats
|
|
6
|
+
|
|
7
|
+
- JPEG (.jpg, .jpeg)
|
|
8
|
+
- PNG (.png)
|
|
9
|
+
- WebP (.webp)
|
|
10
|
+
- AVIF (.avif)
|
|
11
|
+
- GIF (.gif)
|
|
12
|
+
- TIFF (.tiff)
|
|
13
|
+
- SVG (.svg)
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
### `qasai` (default)
|
|
18
|
+
|
|
19
|
+
Runs interactive mode with guided prompts.
|
|
20
|
+
|
|
21
|
+
### `qasai compress [input]`
|
|
22
|
+
|
|
23
|
+
Compress images in a directory or file.
|
|
24
|
+
|
|
25
|
+
**Arguments:**
|
|
26
|
+
- `input` - Input directory or file (default: `.`)
|
|
27
|
+
|
|
28
|
+
**Options:**
|
|
29
|
+
|
|
30
|
+
| Option | Description | Default |
|
|
31
|
+
|--------|-------------|---------|
|
|
32
|
+
| `-o, --output <dir>` | Output directory | `Kasai/` in input dir |
|
|
33
|
+
| `-i, --in-place` | Overwrite originals | `false` |
|
|
34
|
+
| `-q, --quality <n>` | Quality 1-100 | `80` |
|
|
35
|
+
| `-l, --lossless` | Lossless compression | `false` |
|
|
36
|
+
| `--resize <dim>` | Resize (e.g., `800x600`, `50%`) | - |
|
|
37
|
+
| `--max-width <px>` | Max width (keeps aspect ratio) | - |
|
|
38
|
+
| `--max-height <px>` | Max height (keeps aspect ratio) | - |
|
|
39
|
+
| `-f, --format <fmt>` | Convert to format | - |
|
|
40
|
+
| `-r, --recursive` | Process subdirectories | `false` |
|
|
41
|
+
| `--keep-metadata` | Preserve EXIF data | `false` |
|
|
42
|
+
| `--no-progressive` | Disable progressive JPEGs | `false` |
|
|
43
|
+
| `--effort <n>` | Compression effort 1-10 | `6` |
|
|
44
|
+
| `--jpeg-engine <e>` | JPEG engine | `mozjpeg` |
|
|
45
|
+
| `--png-engine <e>` | PNG engine | `pngquant` |
|
|
46
|
+
| `--gif-engine <e>` | GIF engine | `gifsicle` |
|
|
47
|
+
| `--png-quality <r>` | PNG quality range | `65-80` |
|
|
48
|
+
| `--colors <n>` | Max colors for PNG/GIF | `256` |
|
|
49
|
+
|
|
50
|
+
## Compression Engines
|
|
51
|
+
|
|
52
|
+
### JPEG
|
|
53
|
+
|
|
54
|
+
| Engine | Type | Description |
|
|
55
|
+
|--------|------|-------------|
|
|
56
|
+
| `mozjpeg` | Lossy | Best compression, slower |
|
|
57
|
+
| `jpegtran` | Lossless | Optimize without quality loss |
|
|
58
|
+
| `sharp` | Lossy | Fast, good compression |
|
|
59
|
+
|
|
60
|
+
### PNG
|
|
61
|
+
|
|
62
|
+
| Engine | Type | Description |
|
|
63
|
+
|--------|------|-------------|
|
|
64
|
+
| `pngquant` | Lossy | Best compression, quantization |
|
|
65
|
+
| `optipng` | Lossless | Optimize without quality loss |
|
|
66
|
+
| `sharp` | Both | Fast, palette-based |
|
|
67
|
+
|
|
68
|
+
### GIF
|
|
69
|
+
|
|
70
|
+
| Engine | Type | Description |
|
|
71
|
+
|--------|------|-------------|
|
|
72
|
+
| `gifsicle` | Both | Best for animated GIFs |
|
|
73
|
+
| `sharp` | Lossy | Fast, basic optimization |
|
|
74
|
+
|
|
75
|
+
### SVG
|
|
76
|
+
|
|
77
|
+
Uses SVGO with multipass optimization.
|
|
78
|
+
|
|
79
|
+
### WebP/AVIF/TIFF
|
|
80
|
+
|
|
81
|
+
Uses Sharp for all operations.
|
|
82
|
+
|
|
83
|
+
## Output
|
|
84
|
+
|
|
85
|
+
Compression results show:
|
|
86
|
+
- Original size
|
|
87
|
+
- Compressed size
|
|
88
|
+
- Bytes saved
|
|
89
|
+
- Percentage saved
|
|
90
|
+
|
|
91
|
+
## Examples
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Interactive mode
|
|
95
|
+
qasai
|
|
96
|
+
|
|
97
|
+
# Compress current directory
|
|
98
|
+
qasai compress
|
|
99
|
+
|
|
100
|
+
# Compress with quality 60
|
|
101
|
+
qasai compress ./images -q 60
|
|
102
|
+
|
|
103
|
+
# Lossless compression
|
|
104
|
+
qasai compress ./images -l
|
|
105
|
+
|
|
106
|
+
# Convert to WebP
|
|
107
|
+
qasai compress ./images -f webp
|
|
108
|
+
|
|
109
|
+
# Resize and compress
|
|
110
|
+
qasai compress ./images --max-width 1920 -q 75
|
|
111
|
+
|
|
112
|
+
# In-place compression
|
|
113
|
+
qasai compress ./images -i
|
|
114
|
+
```
|
package/package.json
CHANGED
package/skills/SKILL.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qasai
|
|
3
|
+
description: Image compression CLI with lossless/lossy options, multiple engines, batch processing, and format conversion. Use when compressing, optimizing, or converting images.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
metadata:
|
|
6
|
+
author: ahmadawais
|
|
7
|
+
version: "0.0.3"
|
|
8
|
+
repository: https://github.com/ahmadawais/qasai
|
|
9
|
+
allowed-tools:
|
|
10
|
+
- shell
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# QASAI - Image Compression CLI
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx qasai
|
|
19
|
+
# or install globally
|
|
20
|
+
npm install -g qasai
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## When to Use
|
|
24
|
+
|
|
25
|
+
- Compressing images for web optimization
|
|
26
|
+
- Batch processing image directories
|
|
27
|
+
- Converting between image formats (JPG, PNG, WebP, AVIF)
|
|
28
|
+
- Resizing images while maintaining aspect ratio
|
|
29
|
+
- Lossless optimization without quality loss
|
|
30
|
+
|
|
31
|
+
## Supported Formats
|
|
32
|
+
|
|
33
|
+
JPEG, PNG, WebP, AVIF, GIF, TIFF, SVG
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
### Interactive Mode
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx qasai
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Launches guided prompts for compression options.
|
|
44
|
+
|
|
45
|
+
### Compress Command
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx qasai compress [input] [options]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Common Workflows
|
|
52
|
+
|
|
53
|
+
### 1. Basic Compression (Web Optimized)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx qasai compress ./images -q 80 --max-width 1920 -r
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 2. Maximum Compression
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx qasai compress ./images -q 60 --jpeg-engine mozjpeg --png-engine pngquant
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 3. Lossless Optimization
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx qasai compress ./images --jpeg-engine jpegtran --png-engine optipng -l
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 4. Convert to Modern Formats
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# WebP (good browser support)
|
|
75
|
+
npx qasai compress ./images -f webp -q 80
|
|
76
|
+
|
|
77
|
+
# AVIF (best compression)
|
|
78
|
+
npx qasai compress ./images -f avif -q 70
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 5. Resize Images
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Max width 1920px (maintains aspect ratio)
|
|
85
|
+
npx qasai compress ./images --max-width 1920
|
|
86
|
+
|
|
87
|
+
# Specific dimensions
|
|
88
|
+
npx qasai compress ./images --resize 800x600
|
|
89
|
+
|
|
90
|
+
# Scale to 50%
|
|
91
|
+
npx qasai compress ./images --resize 50%
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 6. In-Place Compression (Overwrite Originals)
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx qasai compress ./images -i -q 80
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 7. Custom Output Directory
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx qasai compress ./images -o ./compressed
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## CLI Options Reference
|
|
107
|
+
|
|
108
|
+
| Option | Description | Default |
|
|
109
|
+
|--------|-------------|---------|
|
|
110
|
+
| `-o, --output <dir>` | Output directory | `Kasai/` folder |
|
|
111
|
+
| `-i, --in-place` | Overwrite original files | `false` |
|
|
112
|
+
| `-q, --quality <n>` | Quality 1-100 | `80` |
|
|
113
|
+
| `-l, --lossless` | Lossless compression | `false` |
|
|
114
|
+
| `--resize <dim>` | Resize (e.g., `800x600`, `50%`) | - |
|
|
115
|
+
| `--max-width <px>` | Max width (keeps aspect ratio) | - |
|
|
116
|
+
| `--max-height <px>` | Max height (keeps aspect ratio) | - |
|
|
117
|
+
| `-f, --format <fmt>` | Convert to format (jpg, png, webp, avif) | - |
|
|
118
|
+
| `-r, --recursive` | Process subdirectories | `false` |
|
|
119
|
+
| `--keep-metadata` | Preserve EXIF data | `false` |
|
|
120
|
+
| `--effort <n>` | Compression effort 1-10 | `6` |
|
|
121
|
+
| `--jpeg-engine <e>` | mozjpeg, jpegtran, sharp | `mozjpeg` |
|
|
122
|
+
| `--png-engine <e>` | pngquant, optipng, sharp | `pngquant` |
|
|
123
|
+
| `--gif-engine <e>` | gifsicle, sharp | `gifsicle` |
|
|
124
|
+
| `--png-quality <r>` | pngquant quality range | `65-80` |
|
|
125
|
+
| `--colors <n>` | Max colors for PNG/GIF | `256` |
|
|
126
|
+
|
|
127
|
+
## Compression Engines
|
|
128
|
+
|
|
129
|
+
### JPEG Engines
|
|
130
|
+
|
|
131
|
+
- **mozjpeg** (default): Best compression, 5-10% smaller than libjpeg
|
|
132
|
+
- **jpegtran**: Pure lossless, only reorganizes data
|
|
133
|
+
- **sharp**: Fastest option
|
|
134
|
+
|
|
135
|
+
### PNG Engines
|
|
136
|
+
|
|
137
|
+
- **pngquant** (default): 60-80% size reduction, reduces to 256 colors
|
|
138
|
+
- **optipng**: Pixel-perfect lossless
|
|
139
|
+
- **sharp**: Fast with good compression
|
|
140
|
+
|
|
141
|
+
### GIF Engine
|
|
142
|
+
|
|
143
|
+
- **gifsicle** (default): Best for animated GIFs, preserves animation
|
|
144
|
+
|
|
145
|
+
## Output
|
|
146
|
+
|
|
147
|
+
Results show per-file:
|
|
148
|
+
- Original size
|
|
149
|
+
- Compressed size
|
|
150
|
+
- Bytes saved
|
|
151
|
+
- Percentage saved
|
|
152
|
+
|
|
153
|
+
## Examples for Agents
|
|
154
|
+
|
|
155
|
+
When user asks to optimize images:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Default web optimization
|
|
159
|
+
npx qasai compress ./path/to/images -r -q 80
|
|
160
|
+
|
|
161
|
+
# For production deployment
|
|
162
|
+
npx qasai compress ./public/images -r --max-width 1920 -f webp -o ./public/optimized
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
When user wants lossless:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npx qasai compress ./images --jpeg-engine jpegtran --png-engine optipng
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
When user wants smallest file size:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
npx qasai compress ./images -q 60 -f avif
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## References
|
|
178
|
+
|
|
179
|
+
- [Full Specification](./spec.md) - Detailed CLI specification and all options
|
package/skills/spec.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# QASAI Specification
|
|
2
|
+
|
|
3
|
+
Image compression CLI with lossless and lossy options.
|
|
4
|
+
|
|
5
|
+
## Supported Formats
|
|
6
|
+
|
|
7
|
+
- JPEG (.jpg, .jpeg)
|
|
8
|
+
- PNG (.png)
|
|
9
|
+
- WebP (.webp)
|
|
10
|
+
- AVIF (.avif)
|
|
11
|
+
- GIF (.gif)
|
|
12
|
+
- TIFF (.tiff)
|
|
13
|
+
- SVG (.svg)
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
### `qasai` (default)
|
|
18
|
+
|
|
19
|
+
Runs interactive mode with guided prompts.
|
|
20
|
+
|
|
21
|
+
### `qasai compress [input]`
|
|
22
|
+
|
|
23
|
+
Compress images in a directory or file.
|
|
24
|
+
|
|
25
|
+
**Arguments:**
|
|
26
|
+
- `input` - Input directory or file (default: `.`)
|
|
27
|
+
|
|
28
|
+
**Options:**
|
|
29
|
+
|
|
30
|
+
| Option | Description | Default |
|
|
31
|
+
|--------|-------------|---------|
|
|
32
|
+
| `-o, --output <dir>` | Output directory | `Kasai/` in input dir |
|
|
33
|
+
| `-i, --in-place` | Overwrite originals | `false` |
|
|
34
|
+
| `-q, --quality <n>` | Quality 1-100 | `80` |
|
|
35
|
+
| `-l, --lossless` | Lossless compression | `false` |
|
|
36
|
+
| `--resize <dim>` | Resize (e.g., `800x600`, `50%`) | - |
|
|
37
|
+
| `--max-width <px>` | Max width (keeps aspect ratio) | - |
|
|
38
|
+
| `--max-height <px>` | Max height (keeps aspect ratio) | - |
|
|
39
|
+
| `-f, --format <fmt>` | Convert to format | - |
|
|
40
|
+
| `-r, --recursive` | Process subdirectories | `false` |
|
|
41
|
+
| `--keep-metadata` | Preserve EXIF data | `false` |
|
|
42
|
+
| `--no-progressive` | Disable progressive JPEGs | `false` |
|
|
43
|
+
| `--effort <n>` | Compression effort 1-10 | `6` |
|
|
44
|
+
| `--jpeg-engine <e>` | JPEG engine | `mozjpeg` |
|
|
45
|
+
| `--png-engine <e>` | PNG engine | `pngquant` |
|
|
46
|
+
| `--gif-engine <e>` | GIF engine | `gifsicle` |
|
|
47
|
+
| `--png-quality <r>` | PNG quality range | `65-80` |
|
|
48
|
+
| `--colors <n>` | Max colors for PNG/GIF | `256` |
|
|
49
|
+
|
|
50
|
+
## Compression Engines
|
|
51
|
+
|
|
52
|
+
### JPEG
|
|
53
|
+
|
|
54
|
+
| Engine | Type | Description |
|
|
55
|
+
|--------|------|-------------|
|
|
56
|
+
| `mozjpeg` | Lossy | Best compression, slower |
|
|
57
|
+
| `jpegtran` | Lossless | Optimize without quality loss |
|
|
58
|
+
| `sharp` | Lossy | Fast, good compression |
|
|
59
|
+
|
|
60
|
+
### PNG
|
|
61
|
+
|
|
62
|
+
| Engine | Type | Description |
|
|
63
|
+
|--------|------|-------------|
|
|
64
|
+
| `pngquant` | Lossy | Best compression, quantization |
|
|
65
|
+
| `optipng` | Lossless | Optimize without quality loss |
|
|
66
|
+
| `sharp` | Both | Fast, palette-based |
|
|
67
|
+
|
|
68
|
+
### GIF
|
|
69
|
+
|
|
70
|
+
| Engine | Type | Description |
|
|
71
|
+
|--------|------|-------------|
|
|
72
|
+
| `gifsicle` | Both | Best for animated GIFs |
|
|
73
|
+
| `sharp` | Lossy | Fast, basic optimization |
|
|
74
|
+
|
|
75
|
+
### SVG
|
|
76
|
+
|
|
77
|
+
Uses SVGO with multipass optimization.
|
|
78
|
+
|
|
79
|
+
### WebP/AVIF/TIFF
|
|
80
|
+
|
|
81
|
+
Uses Sharp for all operations.
|
|
82
|
+
|
|
83
|
+
## Output
|
|
84
|
+
|
|
85
|
+
Compression results show:
|
|
86
|
+
- Original size
|
|
87
|
+
- Compressed size
|
|
88
|
+
- Bytes saved
|
|
89
|
+
- Percentage saved
|
|
90
|
+
|
|
91
|
+
## Examples
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Interactive mode
|
|
95
|
+
qasai
|
|
96
|
+
|
|
97
|
+
# Compress current directory
|
|
98
|
+
qasai compress
|
|
99
|
+
|
|
100
|
+
# Compress with quality 60
|
|
101
|
+
qasai compress ./images -q 60
|
|
102
|
+
|
|
103
|
+
# Lossless compression
|
|
104
|
+
qasai compress ./images -l
|
|
105
|
+
|
|
106
|
+
# Convert to WebP
|
|
107
|
+
qasai compress ./images -f webp
|
|
108
|
+
|
|
109
|
+
# Resize and compress
|
|
110
|
+
qasai compress ./images --max-width 1920 -q 75
|
|
111
|
+
|
|
112
|
+
# In-place compression
|
|
113
|
+
qasai compress ./images -i
|
|
114
|
+
```
|