ai-pack-cli 0.1.7__tar.gz → 0.1.9__tar.gz
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.
- ai_pack_cli-0.1.9/PKG-INFO +173 -0
- ai_pack_cli-0.1.9/README.md +160 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/ai_pack.py +3 -3
- ai_pack_cli-0.1.9/ai_pack_cli.egg-info/PKG-INFO +173 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/setup.py +1 -1
- ai_pack_cli-0.1.7/PKG-INFO +0 -168
- ai_pack_cli-0.1.7/README.md +0 -155
- ai_pack_cli-0.1.7/ai_pack_cli.egg-info/PKG-INFO +0 -168
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/ai_pack_cli.egg-info/SOURCES.txt +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/ai_pack_cli.egg-info/dependency_links.txt +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/ai_pack_cli.egg-info/entry_points.txt +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/ai_pack_cli.egg-info/requires.txt +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/ai_pack_cli.egg-info/top_level.txt +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/setup.cfg +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/tests/test_binary.py +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/tests/test_gitignore.py +0 -0
- {ai_pack_cli-0.1.7 → ai_pack_cli-0.1.9}/tests/test_skeleton.py +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ai-pack-cli
|
|
3
|
+
Version: 0.1.9
|
|
4
|
+
Home-page: https://github.com/iamraydoan/ai-pack
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: pyperclip>=1.8.2
|
|
10
|
+
Requires-Dist: questionary>=1.10.0
|
|
11
|
+
Requires-Dist: codesigs>=0.0.1; python_version >= "3.9"
|
|
12
|
+
Requires-Dist: ast-grep-py<=0.39.7; python_version == "3.9"
|
|
13
|
+
|
|
14
|
+
# 📦 ai-pack
|
|
15
|
+
|
|
16
|
+
[](https://www.python.org/)
|
|
17
|
+
[](LICENSE)
|
|
18
|
+
[](https://badge.fury.io/py/ai-pack-cli)
|
|
19
|
+
[](https://github.com/iamraydoan/ai-pack)
|
|
20
|
+
|
|
21
|
+
Pack your entire codebase, specific files, or uncommitted changes into a single token-optimized Markdown prompt for LLMs (like ChatGPT, Claude, Gemini).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
> [!IMPORTANT]
|
|
26
|
+
> **📋 Default Clipboard Behavior**
|
|
27
|
+
>
|
|
28
|
+
> By default, running `aip` **automatically copies** the generated Markdown payload directly to your **system clipboard**. No files are saved to disk unless you specify the output file using the `-o` or `--output` flag.
|
|
29
|
+
>
|
|
30
|
+
> *Note: It also natively supports remote SSH sessions using the OSC 52 clipboard escape sequence.*
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## ⚡ Key Features
|
|
35
|
+
|
|
36
|
+
* **📋 Clipboard-First**: Automatically copies your prompt, ready to paste straight into ChatGPT, Claude, Gemini, or any LLM interface.
|
|
37
|
+
* **💀 Skeleton Mode (`-s` / `--skeleton`)**: Drastically saves tokens by stripping function/method bodies, keeping only class structures, signatures, and imports.
|
|
38
|
+
* **🎯 Interactive Selector (`-i`)**: Choose files interactively via checkbox CLI menu.
|
|
39
|
+
* **🌿 Git-Aware (`-c` / `--changed`)**: Automatically pack only modified, staged, or untracked files.
|
|
40
|
+
* **🛡️ Gitignore-Respecting**: Excludes ignored, temporary, or build files automatically (using `git ls-files` with manual fallback for non-git folders).
|
|
41
|
+
* **💬 Prompt Presets (`-p`)**: Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
|
|
42
|
+
* **📊 Token Estimation**: Heuristic token counting warns you if your payload exceeds your limit (`--max-tokens`).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
47
|
+
|
|
48
|
+
### Installation
|
|
49
|
+
|
|
50
|
+
Choose your preferred installation method:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Option 1: Install official package via pip (Recommended)
|
|
54
|
+
pip3 install ai-pack-cli --user
|
|
55
|
+
|
|
56
|
+
# Option 2: Install via pipx (Isolated environment)
|
|
57
|
+
pipx install ai-pack-cli
|
|
58
|
+
|
|
59
|
+
# Option 3: Install development version directly from GitHub
|
|
60
|
+
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> [!TIP]
|
|
64
|
+
> **Skeleton Mode (`-s` / `--skeleton`) for non-Python languages:**
|
|
65
|
+
> To extract code skeletons for JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin, install `ast-grep` globally:
|
|
66
|
+
> ```bash
|
|
67
|
+
> npm install -g @ast-grep/cli
|
|
68
|
+
> # or: cargo install ast-grep
|
|
69
|
+
> ```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 💡 Usage & Common Scenarios
|
|
74
|
+
|
|
75
|
+
Here are common ways to use `ai-pack` (using commands `aip`, `ai-pack`, or `aipack`):
|
|
76
|
+
|
|
77
|
+
### 1. Pack codebase & copy to clipboard (Default)
|
|
78
|
+
```bash
|
|
79
|
+
aip
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Pack specific files/folders and save to a file
|
|
83
|
+
```bash
|
|
84
|
+
aip -f src/main.py tests/ -o output.md
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Pack only uncommitted changes with a code review prompt
|
|
88
|
+
```bash
|
|
89
|
+
aip -c -p review
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 4. Pack code skeleton to save context window tokens
|
|
93
|
+
```bash
|
|
94
|
+
aip -s -p explain
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 5. Choose files interactively before packing
|
|
98
|
+
```bash
|
|
99
|
+
aip -i
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## ⚙️ CLI Flags & Interactions
|
|
105
|
+
|
|
106
|
+
### Reference
|
|
107
|
+
|
|
108
|
+
| Flag | Short | Type | Description |
|
|
109
|
+
| :--- | :--- | :--- | :--- |
|
|
110
|
+
| `--files` | `-f` | Path(s) | Specific files or directories to pack (space-separated). |
|
|
111
|
+
| `--changed` | `-c` | Flag | Pack only modified, staged, or untracked Git files. |
|
|
112
|
+
| `--interactive` | `-i` | Flag | Select files interactively via a checkbox menu. |
|
|
113
|
+
| `--skeleton` | `-s` | Flag | Strip method bodies, leaving only signatures and imports to save tokens. |
|
|
114
|
+
| `--prompt` | `-p` | Choices | Prepend preset: `review`, `bug`, or `explain`. |
|
|
115
|
+
| `--output` | `-o` | Path | Save output directly to a file instead of copying to clipboard. |
|
|
116
|
+
| `--max-tokens` | | Number | Count approximate tokens and warn if the limit is exceeded. |
|
|
117
|
+
|
|
118
|
+
### 🤝 Combining Flags
|
|
119
|
+
|
|
120
|
+
You can combine flags to narrow down and customize your payload:
|
|
121
|
+
|
|
122
|
+
* **Filter Git changes (`-f` + `-c` / `--changed`)**:
|
|
123
|
+
Only packs files that are *both* modified/uncommitted AND located inside the specified paths.
|
|
124
|
+
```bash
|
|
125
|
+
aip -c -f src/
|
|
126
|
+
```
|
|
127
|
+
* **Interactive selection with filter (`-i` + `-f` / `-c`)**:
|
|
128
|
+
Shows only the filtered list (e.g. only changed files) in the interactive checkbox menu instead of the entire repo.
|
|
129
|
+
```bash
|
|
130
|
+
aip -i -c
|
|
131
|
+
```
|
|
132
|
+
* **Structure only (`-s` / `--skeleton` + any mode)**:
|
|
133
|
+
Can be appended to any command to extract skeletons instead of full source code for the selected files.
|
|
134
|
+
```bash
|
|
135
|
+
aip -i -s
|
|
136
|
+
```
|
|
137
|
+
* **Redirect output (`-o` vs Default)**:
|
|
138
|
+
By default, everything goes to the clipboard. Use `-o filename.md` to save to a file instead.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 💀 Skeleton Mode Example
|
|
143
|
+
|
|
144
|
+
### Original Code:
|
|
145
|
+
```python
|
|
146
|
+
def fibonacci(n):
|
|
147
|
+
if n <= 0:
|
|
148
|
+
return []
|
|
149
|
+
elif n == 1:
|
|
150
|
+
return [0]
|
|
151
|
+
sequence = [0, 1]
|
|
152
|
+
while len(sequence) < n:
|
|
153
|
+
sequence.append(sequence[-1] + sequence[-2])
|
|
154
|
+
return sequence
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Skeleton Output:
|
|
158
|
+
```python
|
|
159
|
+
def fibonacci(n):
|
|
160
|
+
...
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🤝 Contributing
|
|
166
|
+
|
|
167
|
+
1. Fork the repository.
|
|
168
|
+
2. Create your feature branch (`git checkout -b feat/amazing-feature`).
|
|
169
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
170
|
+
4. Push to the branch (`git push origin feat/amazing-feature`).
|
|
171
|
+
5. Open a Pull Request.
|
|
172
|
+
|
|
173
|
+
Give this repository a ⭐ if it helped you pack your code for LLMs!
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# 📦 ai-pack
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://badge.fury.io/py/ai-pack-cli)
|
|
6
|
+
[](https://github.com/iamraydoan/ai-pack)
|
|
7
|
+
|
|
8
|
+
Pack your entire codebase, specific files, or uncommitted changes into a single token-optimized Markdown prompt for LLMs (like ChatGPT, Claude, Gemini).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
> [!IMPORTANT]
|
|
13
|
+
> **📋 Default Clipboard Behavior**
|
|
14
|
+
>
|
|
15
|
+
> By default, running `aip` **automatically copies** the generated Markdown payload directly to your **system clipboard**. No files are saved to disk unless you specify the output file using the `-o` or `--output` flag.
|
|
16
|
+
>
|
|
17
|
+
> *Note: It also natively supports remote SSH sessions using the OSC 52 clipboard escape sequence.*
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚡ Key Features
|
|
22
|
+
|
|
23
|
+
* **📋 Clipboard-First**: Automatically copies your prompt, ready to paste straight into ChatGPT, Claude, Gemini, or any LLM interface.
|
|
24
|
+
* **💀 Skeleton Mode (`-s` / `--skeleton`)**: Drastically saves tokens by stripping function/method bodies, keeping only class structures, signatures, and imports.
|
|
25
|
+
* **🎯 Interactive Selector (`-i`)**: Choose files interactively via checkbox CLI menu.
|
|
26
|
+
* **🌿 Git-Aware (`-c` / `--changed`)**: Automatically pack only modified, staged, or untracked files.
|
|
27
|
+
* **🛡️ Gitignore-Respecting**: Excludes ignored, temporary, or build files automatically (using `git ls-files` with manual fallback for non-git folders).
|
|
28
|
+
* **💬 Prompt Presets (`-p`)**: Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
|
|
29
|
+
* **📊 Token Estimation**: Heuristic token counting warns you if your payload exceeds your limit (`--max-tokens`).
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🚀 Quick Start
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
Choose your preferred installation method:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Option 1: Install official package via pip (Recommended)
|
|
41
|
+
pip3 install ai-pack-cli --user
|
|
42
|
+
|
|
43
|
+
# Option 2: Install via pipx (Isolated environment)
|
|
44
|
+
pipx install ai-pack-cli
|
|
45
|
+
|
|
46
|
+
# Option 3: Install development version directly from GitHub
|
|
47
|
+
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> [!TIP]
|
|
51
|
+
> **Skeleton Mode (`-s` / `--skeleton`) for non-Python languages:**
|
|
52
|
+
> To extract code skeletons for JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin, install `ast-grep` globally:
|
|
53
|
+
> ```bash
|
|
54
|
+
> npm install -g @ast-grep/cli
|
|
55
|
+
> # or: cargo install ast-grep
|
|
56
|
+
> ```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 💡 Usage & Common Scenarios
|
|
61
|
+
|
|
62
|
+
Here are common ways to use `ai-pack` (using commands `aip`, `ai-pack`, or `aipack`):
|
|
63
|
+
|
|
64
|
+
### 1. Pack codebase & copy to clipboard (Default)
|
|
65
|
+
```bash
|
|
66
|
+
aip
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Pack specific files/folders and save to a file
|
|
70
|
+
```bash
|
|
71
|
+
aip -f src/main.py tests/ -o output.md
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 3. Pack only uncommitted changes with a code review prompt
|
|
75
|
+
```bash
|
|
76
|
+
aip -c -p review
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 4. Pack code skeleton to save context window tokens
|
|
80
|
+
```bash
|
|
81
|
+
aip -s -p explain
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 5. Choose files interactively before packing
|
|
85
|
+
```bash
|
|
86
|
+
aip -i
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## ⚙️ CLI Flags & Interactions
|
|
92
|
+
|
|
93
|
+
### Reference
|
|
94
|
+
|
|
95
|
+
| Flag | Short | Type | Description |
|
|
96
|
+
| :--- | :--- | :--- | :--- |
|
|
97
|
+
| `--files` | `-f` | Path(s) | Specific files or directories to pack (space-separated). |
|
|
98
|
+
| `--changed` | `-c` | Flag | Pack only modified, staged, or untracked Git files. |
|
|
99
|
+
| `--interactive` | `-i` | Flag | Select files interactively via a checkbox menu. |
|
|
100
|
+
| `--skeleton` | `-s` | Flag | Strip method bodies, leaving only signatures and imports to save tokens. |
|
|
101
|
+
| `--prompt` | `-p` | Choices | Prepend preset: `review`, `bug`, or `explain`. |
|
|
102
|
+
| `--output` | `-o` | Path | Save output directly to a file instead of copying to clipboard. |
|
|
103
|
+
| `--max-tokens` | | Number | Count approximate tokens and warn if the limit is exceeded. |
|
|
104
|
+
|
|
105
|
+
### 🤝 Combining Flags
|
|
106
|
+
|
|
107
|
+
You can combine flags to narrow down and customize your payload:
|
|
108
|
+
|
|
109
|
+
* **Filter Git changes (`-f` + `-c` / `--changed`)**:
|
|
110
|
+
Only packs files that are *both* modified/uncommitted AND located inside the specified paths.
|
|
111
|
+
```bash
|
|
112
|
+
aip -c -f src/
|
|
113
|
+
```
|
|
114
|
+
* **Interactive selection with filter (`-i` + `-f` / `-c`)**:
|
|
115
|
+
Shows only the filtered list (e.g. only changed files) in the interactive checkbox menu instead of the entire repo.
|
|
116
|
+
```bash
|
|
117
|
+
aip -i -c
|
|
118
|
+
```
|
|
119
|
+
* **Structure only (`-s` / `--skeleton` + any mode)**:
|
|
120
|
+
Can be appended to any command to extract skeletons instead of full source code for the selected files.
|
|
121
|
+
```bash
|
|
122
|
+
aip -i -s
|
|
123
|
+
```
|
|
124
|
+
* **Redirect output (`-o` vs Default)**:
|
|
125
|
+
By default, everything goes to the clipboard. Use `-o filename.md` to save to a file instead.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 💀 Skeleton Mode Example
|
|
130
|
+
|
|
131
|
+
### Original Code:
|
|
132
|
+
```python
|
|
133
|
+
def fibonacci(n):
|
|
134
|
+
if n <= 0:
|
|
135
|
+
return []
|
|
136
|
+
elif n == 1:
|
|
137
|
+
return [0]
|
|
138
|
+
sequence = [0, 1]
|
|
139
|
+
while len(sequence) < n:
|
|
140
|
+
sequence.append(sequence[-1] + sequence[-2])
|
|
141
|
+
return sequence
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Skeleton Output:
|
|
145
|
+
```python
|
|
146
|
+
def fibonacci(n):
|
|
147
|
+
...
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🤝 Contributing
|
|
153
|
+
|
|
154
|
+
1. Fork the repository.
|
|
155
|
+
2. Create your feature branch (`git checkout -b feat/amazing-feature`).
|
|
156
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
157
|
+
4. Push to the branch (`git push origin feat/amazing-feature`).
|
|
158
|
+
5. Open a Pull Request.
|
|
159
|
+
|
|
160
|
+
Give this repository a ⭐ if it helped you pack your code for LLMs!
|
|
@@ -314,7 +314,7 @@ def interactive_select(files: List[str]) -> List[str]:
|
|
|
314
314
|
choices = []
|
|
315
315
|
for f in files:
|
|
316
316
|
rel = os.path.relpath(f, cwd)
|
|
317
|
-
choices.append(questionary.Choice(title=rel, value=f, checked=
|
|
317
|
+
choices.append(questionary.Choice(title=rel, value=f, checked=False))
|
|
318
318
|
|
|
319
319
|
if not choices:
|
|
320
320
|
print("⚠️ No files available to select.")
|
|
@@ -371,12 +371,12 @@ def parse_args():
|
|
|
371
371
|
help="Explicitly specify files or directories to pack, ignoring the rest."
|
|
372
372
|
)
|
|
373
373
|
parser.add_argument(
|
|
374
|
-
"--changed",
|
|
374
|
+
"-c", "--changed",
|
|
375
375
|
action="store_true",
|
|
376
376
|
help="Only pack uncommitted or modified files (requires Git)."
|
|
377
377
|
)
|
|
378
378
|
parser.add_argument(
|
|
379
|
-
"--skeleton",
|
|
379
|
+
"-s", "--skeleton",
|
|
380
380
|
action="store_true",
|
|
381
381
|
help="Extract only class definitions, function signatures, and imports/exports to save tokens."
|
|
382
382
|
)
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ai-pack-cli
|
|
3
|
+
Version: 0.1.9
|
|
4
|
+
Home-page: https://github.com/iamraydoan/ai-pack
|
|
5
|
+
Classifier: Programming Language :: Python :: 3
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Requires-Dist: pyperclip>=1.8.2
|
|
10
|
+
Requires-Dist: questionary>=1.10.0
|
|
11
|
+
Requires-Dist: codesigs>=0.0.1; python_version >= "3.9"
|
|
12
|
+
Requires-Dist: ast-grep-py<=0.39.7; python_version == "3.9"
|
|
13
|
+
|
|
14
|
+
# 📦 ai-pack
|
|
15
|
+
|
|
16
|
+
[](https://www.python.org/)
|
|
17
|
+
[](LICENSE)
|
|
18
|
+
[](https://badge.fury.io/py/ai-pack-cli)
|
|
19
|
+
[](https://github.com/iamraydoan/ai-pack)
|
|
20
|
+
|
|
21
|
+
Pack your entire codebase, specific files, or uncommitted changes into a single token-optimized Markdown prompt for LLMs (like ChatGPT, Claude, Gemini).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
> [!IMPORTANT]
|
|
26
|
+
> **📋 Default Clipboard Behavior**
|
|
27
|
+
>
|
|
28
|
+
> By default, running `aip` **automatically copies** the generated Markdown payload directly to your **system clipboard**. No files are saved to disk unless you specify the output file using the `-o` or `--output` flag.
|
|
29
|
+
>
|
|
30
|
+
> *Note: It also natively supports remote SSH sessions using the OSC 52 clipboard escape sequence.*
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## ⚡ Key Features
|
|
35
|
+
|
|
36
|
+
* **📋 Clipboard-First**: Automatically copies your prompt, ready to paste straight into ChatGPT, Claude, Gemini, or any LLM interface.
|
|
37
|
+
* **💀 Skeleton Mode (`-s` / `--skeleton`)**: Drastically saves tokens by stripping function/method bodies, keeping only class structures, signatures, and imports.
|
|
38
|
+
* **🎯 Interactive Selector (`-i`)**: Choose files interactively via checkbox CLI menu.
|
|
39
|
+
* **🌿 Git-Aware (`-c` / `--changed`)**: Automatically pack only modified, staged, or untracked files.
|
|
40
|
+
* **🛡️ Gitignore-Respecting**: Excludes ignored, temporary, or build files automatically (using `git ls-files` with manual fallback for non-git folders).
|
|
41
|
+
* **💬 Prompt Presets (`-p`)**: Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
|
|
42
|
+
* **📊 Token Estimation**: Heuristic token counting warns you if your payload exceeds your limit (`--max-tokens`).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
47
|
+
|
|
48
|
+
### Installation
|
|
49
|
+
|
|
50
|
+
Choose your preferred installation method:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Option 1: Install official package via pip (Recommended)
|
|
54
|
+
pip3 install ai-pack-cli --user
|
|
55
|
+
|
|
56
|
+
# Option 2: Install via pipx (Isolated environment)
|
|
57
|
+
pipx install ai-pack-cli
|
|
58
|
+
|
|
59
|
+
# Option 3: Install development version directly from GitHub
|
|
60
|
+
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> [!TIP]
|
|
64
|
+
> **Skeleton Mode (`-s` / `--skeleton`) for non-Python languages:**
|
|
65
|
+
> To extract code skeletons for JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin, install `ast-grep` globally:
|
|
66
|
+
> ```bash
|
|
67
|
+
> npm install -g @ast-grep/cli
|
|
68
|
+
> # or: cargo install ast-grep
|
|
69
|
+
> ```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 💡 Usage & Common Scenarios
|
|
74
|
+
|
|
75
|
+
Here are common ways to use `ai-pack` (using commands `aip`, `ai-pack`, or `aipack`):
|
|
76
|
+
|
|
77
|
+
### 1. Pack codebase & copy to clipboard (Default)
|
|
78
|
+
```bash
|
|
79
|
+
aip
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 2. Pack specific files/folders and save to a file
|
|
83
|
+
```bash
|
|
84
|
+
aip -f src/main.py tests/ -o output.md
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Pack only uncommitted changes with a code review prompt
|
|
88
|
+
```bash
|
|
89
|
+
aip -c -p review
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 4. Pack code skeleton to save context window tokens
|
|
93
|
+
```bash
|
|
94
|
+
aip -s -p explain
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 5. Choose files interactively before packing
|
|
98
|
+
```bash
|
|
99
|
+
aip -i
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## ⚙️ CLI Flags & Interactions
|
|
105
|
+
|
|
106
|
+
### Reference
|
|
107
|
+
|
|
108
|
+
| Flag | Short | Type | Description |
|
|
109
|
+
| :--- | :--- | :--- | :--- |
|
|
110
|
+
| `--files` | `-f` | Path(s) | Specific files or directories to pack (space-separated). |
|
|
111
|
+
| `--changed` | `-c` | Flag | Pack only modified, staged, or untracked Git files. |
|
|
112
|
+
| `--interactive` | `-i` | Flag | Select files interactively via a checkbox menu. |
|
|
113
|
+
| `--skeleton` | `-s` | Flag | Strip method bodies, leaving only signatures and imports to save tokens. |
|
|
114
|
+
| `--prompt` | `-p` | Choices | Prepend preset: `review`, `bug`, or `explain`. |
|
|
115
|
+
| `--output` | `-o` | Path | Save output directly to a file instead of copying to clipboard. |
|
|
116
|
+
| `--max-tokens` | | Number | Count approximate tokens and warn if the limit is exceeded. |
|
|
117
|
+
|
|
118
|
+
### 🤝 Combining Flags
|
|
119
|
+
|
|
120
|
+
You can combine flags to narrow down and customize your payload:
|
|
121
|
+
|
|
122
|
+
* **Filter Git changes (`-f` + `-c` / `--changed`)**:
|
|
123
|
+
Only packs files that are *both* modified/uncommitted AND located inside the specified paths.
|
|
124
|
+
```bash
|
|
125
|
+
aip -c -f src/
|
|
126
|
+
```
|
|
127
|
+
* **Interactive selection with filter (`-i` + `-f` / `-c`)**:
|
|
128
|
+
Shows only the filtered list (e.g. only changed files) in the interactive checkbox menu instead of the entire repo.
|
|
129
|
+
```bash
|
|
130
|
+
aip -i -c
|
|
131
|
+
```
|
|
132
|
+
* **Structure only (`-s` / `--skeleton` + any mode)**:
|
|
133
|
+
Can be appended to any command to extract skeletons instead of full source code for the selected files.
|
|
134
|
+
```bash
|
|
135
|
+
aip -i -s
|
|
136
|
+
```
|
|
137
|
+
* **Redirect output (`-o` vs Default)**:
|
|
138
|
+
By default, everything goes to the clipboard. Use `-o filename.md` to save to a file instead.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 💀 Skeleton Mode Example
|
|
143
|
+
|
|
144
|
+
### Original Code:
|
|
145
|
+
```python
|
|
146
|
+
def fibonacci(n):
|
|
147
|
+
if n <= 0:
|
|
148
|
+
return []
|
|
149
|
+
elif n == 1:
|
|
150
|
+
return [0]
|
|
151
|
+
sequence = [0, 1]
|
|
152
|
+
while len(sequence) < n:
|
|
153
|
+
sequence.append(sequence[-1] + sequence[-2])
|
|
154
|
+
return sequence
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Skeleton Output:
|
|
158
|
+
```python
|
|
159
|
+
def fibonacci(n):
|
|
160
|
+
...
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 🤝 Contributing
|
|
166
|
+
|
|
167
|
+
1. Fork the repository.
|
|
168
|
+
2. Create your feature branch (`git checkout -b feat/amazing-feature`).
|
|
169
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
170
|
+
4. Push to the branch (`git push origin feat/amazing-feature`).
|
|
171
|
+
5. Open a Pull Request.
|
|
172
|
+
|
|
173
|
+
Give this repository a ⭐ if it helped you pack your code for LLMs!
|
ai_pack_cli-0.1.7/PKG-INFO
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ai-pack-cli
|
|
3
|
-
Version: 0.1.7
|
|
4
|
-
Home-page: https://github.com/iamraydoan/ai-pack
|
|
5
|
-
Classifier: Programming Language :: Python :: 3
|
|
6
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
-
Classifier: Operating System :: OS Independent
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: pyperclip>=1.8.2
|
|
10
|
-
Requires-Dist: questionary>=1.10.0
|
|
11
|
-
Requires-Dist: codesigs>=0.0.1; python_version >= "3.9"
|
|
12
|
-
Requires-Dist: ast-grep-py<=0.39.7; python_version == "3.9"
|
|
13
|
-
|
|
14
|
-
# 📦 ai-pack
|
|
15
|
-
|
|
16
|
-
[](https://www.python.org/)
|
|
17
|
-
[](LICENSE)
|
|
18
|
-
[](https://badge.fury.io/py/ai-pack-cli)
|
|
19
|
-
[](https://github.com/)
|
|
20
|
-
[](https://github.com/iamraydoan/ai-pack)
|
|
21
|
-
|
|
22
|
-
> Pack your entire codebase into a single formatted Markdown prompt for LLMs, optimized for minimum tokens.
|
|
23
|
-
|
|
24
|
-
`ai-pack` is a lightweight, high-performance CLI tool designed to help developers package their codebase, specific files, or uncommitted changes into a clean Markdown payload. Easily copy it to the clipboard or save it to a file to feed directly into ChatGPT, Claude, Gemini, or any other LLM.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 🔥 Key Features
|
|
29
|
-
|
|
30
|
-
* **⚡ Native CLI Command**: Accessible globally as `ai-pack`, `aipack`, or `aip`.
|
|
31
|
-
* **💀 Code Skeleton Extraction (`--skeleton`)**: Drastically save tokens by stripping method and function bodies, keeping only class structures, imports, signatures, and docstrings.
|
|
32
|
-
* **🎯 Interactive Selection (`-i`)**: Interactively choose which files to pack using Arrow keys and Spacebar before generating the payload.
|
|
33
|
-
* **🌿 Git-Aware (`--changed`)**: Automatically detect and pack only modified, staged, or untracked files.
|
|
34
|
-
* **🛡️ Gitignore Respecting**: Native Git integration using `git ls-files` to automatically ignore build artifacts, node modules, and everything in `.gitignore` (with a clean manual fallback for non-git folders).
|
|
35
|
-
* **💬 Predefined LLM Prompts (`-p`)**: Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
|
|
36
|
-
* **📊 Token Estimation**: Heuristic token counting warns you if your payload exceeds your limit (`--max-tokens`).
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 🚀 Quick Start
|
|
41
|
-
|
|
42
|
-
### Installation
|
|
43
|
-
|
|
44
|
-
Choose one of the following methods to get started quickly:
|
|
45
|
-
|
|
46
|
-
#### Option 1: Install from PyPI (Recommended)
|
|
47
|
-
Install the official release from PyPI:
|
|
48
|
-
```bash
|
|
49
|
-
pip3 install ai-pack-cli --user
|
|
50
|
-
```
|
|
51
|
-
Or via `pipx` to run in an isolated environment:
|
|
52
|
-
```bash
|
|
53
|
-
pipx install ai-pack-cli
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### Option 2: Install directly from GitHub
|
|
57
|
-
Install the latest cutting-edge development version directly:
|
|
58
|
-
```bash
|
|
59
|
-
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
#### Option 3: Manual Clone (Editable mode)
|
|
63
|
-
If you want to modify the source code:
|
|
64
|
-
```bash
|
|
65
|
-
git clone https://github.com/iamraydoan/ai-pack.git
|
|
66
|
-
cd ai-pack
|
|
67
|
-
pip3 install -e . --user
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
#### Option 4: Run as a Standalone Script (One-Liner)
|
|
71
|
-
Since `ai-pack` is a self-contained single script, you can download it directly:
|
|
72
|
-
```bash
|
|
73
|
-
curl -o ~/.local/bin/aip https://raw.githubusercontent.com/iamraydoan/ai-pack/main/ai_pack.py && chmod +x ~/.local/bin/aip
|
|
74
|
-
```
|
|
75
|
-
*(Note: If you run it standalone, you will need to manually run `pip3 install pyperclip questionary` to enable all optional interactive and clipboard features).*
|
|
76
|
-
|
|
77
|
-
> [!TIP]
|
|
78
|
-
> **Optional backend for Skeleton Mode (`--skeleton`)**:
|
|
79
|
-
> If you plan to use skeleton extraction for non-Python languages (such as JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin), you must install `ast-grep` globally:
|
|
80
|
-
> ```bash
|
|
81
|
-
> npm install -g @ast-grep/cli
|
|
82
|
-
> # or: cargo install ast-grep
|
|
83
|
-
> ```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### Usage Examples
|
|
87
|
-
|
|
88
|
-
#### 1. Pack the entire repository (copied to clipboard)
|
|
89
|
-
```bash
|
|
90
|
-
aip
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
#### 2. Pack specific files and save to a file
|
|
94
|
-
```bash
|
|
95
|
-
aip -f src/main.py tests/ -o output.md
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### 3. Pack only uncommitted git changes with a code review prompt
|
|
99
|
-
```bash
|
|
100
|
-
aip --changed -p review
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
#### 4. Extract code skeleton only (drastically saves context window tokens)
|
|
104
|
-
```bash
|
|
105
|
-
aip --skeleton -p explain
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
#### 5. Interactively choose files to include
|
|
109
|
-
```bash
|
|
110
|
-
aip -i
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 💀 Skeleton Mode Demo
|
|
116
|
-
|
|
117
|
-
### Original Code (`math.py`):
|
|
118
|
-
```python
|
|
119
|
-
def fibonacci(n):
|
|
120
|
-
if n <= 0:
|
|
121
|
-
return []
|
|
122
|
-
elif n == 1:
|
|
123
|
-
return [0]
|
|
124
|
-
sequence = [0, 1]
|
|
125
|
-
while len(sequence) < n:
|
|
126
|
-
sequence.append(sequence[-1] + sequence[-2])
|
|
127
|
-
return sequence
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Skeleton Output:
|
|
131
|
-
```python
|
|
132
|
-
def fibonacci(n):
|
|
133
|
-
...
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
*Supports Python, JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin via codesigs and ast-grep.*
|
|
137
|
-
|
|
138
|
-
> [!IMPORTANT]
|
|
139
|
-
> **Skeleton Mode Dependencies**:
|
|
140
|
-
> * **Python >= 3.9**: Required to run the `--skeleton` feature.
|
|
141
|
-
> * **ast-grep**: For non-Python languages, the `ast-grep` command-line tool must be installed globally (e.g. via npm: `npm install -g @ast-grep/cli` or cargo: `cargo install ast-grep`).
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## 🎨 Interactive CLI Checklist
|
|
146
|
-
|
|
147
|
-
Running `aip -i` triggers a beautiful checkbox prompt:
|
|
148
|
-
|
|
149
|
-
```text
|
|
150
|
-
? Select files to pack (Space to toggle, Enter to confirm):
|
|
151
|
-
❯ [x] src/main.py
|
|
152
|
-
[x] src/utils.py
|
|
153
|
-
[ ] tests/test_main.py
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## 🤝 Contributing
|
|
159
|
-
|
|
160
|
-
Contributions are welcome! If you have ideas for new features, bug fixes, or enhancements:
|
|
161
|
-
|
|
162
|
-
1. Fork the repo.
|
|
163
|
-
2. Create your feature branch (`git checkout -b feat/amazing-feature`).
|
|
164
|
-
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
165
|
-
4. Push to the branch (`git push origin feat/amazing-feature`).
|
|
166
|
-
5. Open a Pull Request.
|
|
167
|
-
|
|
168
|
-
**Don't forget to give the project a ⭐ if you found it useful!**
|
ai_pack_cli-0.1.7/README.md
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
# 📦 ai-pack
|
|
2
|
-
|
|
3
|
-
[](https://www.python.org/)
|
|
4
|
-
[](LICENSE)
|
|
5
|
-
[](https://badge.fury.io/py/ai-pack-cli)
|
|
6
|
-
[](https://github.com/)
|
|
7
|
-
[](https://github.com/iamraydoan/ai-pack)
|
|
8
|
-
|
|
9
|
-
> Pack your entire codebase into a single formatted Markdown prompt for LLMs, optimized for minimum tokens.
|
|
10
|
-
|
|
11
|
-
`ai-pack` is a lightweight, high-performance CLI tool designed to help developers package their codebase, specific files, or uncommitted changes into a clean Markdown payload. Easily copy it to the clipboard or save it to a file to feed directly into ChatGPT, Claude, Gemini, or any other LLM.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 🔥 Key Features
|
|
16
|
-
|
|
17
|
-
* **⚡ Native CLI Command**: Accessible globally as `ai-pack`, `aipack`, or `aip`.
|
|
18
|
-
* **💀 Code Skeleton Extraction (`--skeleton`)**: Drastically save tokens by stripping method and function bodies, keeping only class structures, imports, signatures, and docstrings.
|
|
19
|
-
* **🎯 Interactive Selection (`-i`)**: Interactively choose which files to pack using Arrow keys and Spacebar before generating the payload.
|
|
20
|
-
* **🌿 Git-Aware (`--changed`)**: Automatically detect and pack only modified, staged, or untracked files.
|
|
21
|
-
* **🛡️ Gitignore Respecting**: Native Git integration using `git ls-files` to automatically ignore build artifacts, node modules, and everything in `.gitignore` (with a clean manual fallback for non-git folders).
|
|
22
|
-
* **💬 Predefined LLM Prompts (`-p`)**: Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
|
|
23
|
-
* **📊 Token Estimation**: Heuristic token counting warns you if your payload exceeds your limit (`--max-tokens`).
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## 🚀 Quick Start
|
|
28
|
-
|
|
29
|
-
### Installation
|
|
30
|
-
|
|
31
|
-
Choose one of the following methods to get started quickly:
|
|
32
|
-
|
|
33
|
-
#### Option 1: Install from PyPI (Recommended)
|
|
34
|
-
Install the official release from PyPI:
|
|
35
|
-
```bash
|
|
36
|
-
pip3 install ai-pack-cli --user
|
|
37
|
-
```
|
|
38
|
-
Or via `pipx` to run in an isolated environment:
|
|
39
|
-
```bash
|
|
40
|
-
pipx install ai-pack-cli
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
#### Option 2: Install directly from GitHub
|
|
44
|
-
Install the latest cutting-edge development version directly:
|
|
45
|
-
```bash
|
|
46
|
-
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
#### Option 3: Manual Clone (Editable mode)
|
|
50
|
-
If you want to modify the source code:
|
|
51
|
-
```bash
|
|
52
|
-
git clone https://github.com/iamraydoan/ai-pack.git
|
|
53
|
-
cd ai-pack
|
|
54
|
-
pip3 install -e . --user
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
#### Option 4: Run as a Standalone Script (One-Liner)
|
|
58
|
-
Since `ai-pack` is a self-contained single script, you can download it directly:
|
|
59
|
-
```bash
|
|
60
|
-
curl -o ~/.local/bin/aip https://raw.githubusercontent.com/iamraydoan/ai-pack/main/ai_pack.py && chmod +x ~/.local/bin/aip
|
|
61
|
-
```
|
|
62
|
-
*(Note: If you run it standalone, you will need to manually run `pip3 install pyperclip questionary` to enable all optional interactive and clipboard features).*
|
|
63
|
-
|
|
64
|
-
> [!TIP]
|
|
65
|
-
> **Optional backend for Skeleton Mode (`--skeleton`)**:
|
|
66
|
-
> If you plan to use skeleton extraction for non-Python languages (such as JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin), you must install `ast-grep` globally:
|
|
67
|
-
> ```bash
|
|
68
|
-
> npm install -g @ast-grep/cli
|
|
69
|
-
> # or: cargo install ast-grep
|
|
70
|
-
> ```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### Usage Examples
|
|
74
|
-
|
|
75
|
-
#### 1. Pack the entire repository (copied to clipboard)
|
|
76
|
-
```bash
|
|
77
|
-
aip
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### 2. Pack specific files and save to a file
|
|
81
|
-
```bash
|
|
82
|
-
aip -f src/main.py tests/ -o output.md
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
#### 3. Pack only uncommitted git changes with a code review prompt
|
|
86
|
-
```bash
|
|
87
|
-
aip --changed -p review
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
#### 4. Extract code skeleton only (drastically saves context window tokens)
|
|
91
|
-
```bash
|
|
92
|
-
aip --skeleton -p explain
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### 5. Interactively choose files to include
|
|
96
|
-
```bash
|
|
97
|
-
aip -i
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## 💀 Skeleton Mode Demo
|
|
103
|
-
|
|
104
|
-
### Original Code (`math.py`):
|
|
105
|
-
```python
|
|
106
|
-
def fibonacci(n):
|
|
107
|
-
if n <= 0:
|
|
108
|
-
return []
|
|
109
|
-
elif n == 1:
|
|
110
|
-
return [0]
|
|
111
|
-
sequence = [0, 1]
|
|
112
|
-
while len(sequence) < n:
|
|
113
|
-
sequence.append(sequence[-1] + sequence[-2])
|
|
114
|
-
return sequence
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### Skeleton Output:
|
|
118
|
-
```python
|
|
119
|
-
def fibonacci(n):
|
|
120
|
-
...
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
*Supports Python, JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin via codesigs and ast-grep.*
|
|
124
|
-
|
|
125
|
-
> [!IMPORTANT]
|
|
126
|
-
> **Skeleton Mode Dependencies**:
|
|
127
|
-
> * **Python >= 3.9**: Required to run the `--skeleton` feature.
|
|
128
|
-
> * **ast-grep**: For non-Python languages, the `ast-grep` command-line tool must be installed globally (e.g. via npm: `npm install -g @ast-grep/cli` or cargo: `cargo install ast-grep`).
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
## 🎨 Interactive CLI Checklist
|
|
133
|
-
|
|
134
|
-
Running `aip -i` triggers a beautiful checkbox prompt:
|
|
135
|
-
|
|
136
|
-
```text
|
|
137
|
-
? Select files to pack (Space to toggle, Enter to confirm):
|
|
138
|
-
❯ [x] src/main.py
|
|
139
|
-
[x] src/utils.py
|
|
140
|
-
[ ] tests/test_main.py
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## 🤝 Contributing
|
|
146
|
-
|
|
147
|
-
Contributions are welcome! If you have ideas for new features, bug fixes, or enhancements:
|
|
148
|
-
|
|
149
|
-
1. Fork the repo.
|
|
150
|
-
2. Create your feature branch (`git checkout -b feat/amazing-feature`).
|
|
151
|
-
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
152
|
-
4. Push to the branch (`git push origin feat/amazing-feature`).
|
|
153
|
-
5. Open a Pull Request.
|
|
154
|
-
|
|
155
|
-
**Don't forget to give the project a ⭐ if you found it useful!**
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ai-pack-cli
|
|
3
|
-
Version: 0.1.7
|
|
4
|
-
Home-page: https://github.com/iamraydoan/ai-pack
|
|
5
|
-
Classifier: Programming Language :: Python :: 3
|
|
6
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
-
Classifier: Operating System :: OS Independent
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
Requires-Dist: pyperclip>=1.8.2
|
|
10
|
-
Requires-Dist: questionary>=1.10.0
|
|
11
|
-
Requires-Dist: codesigs>=0.0.1; python_version >= "3.9"
|
|
12
|
-
Requires-Dist: ast-grep-py<=0.39.7; python_version == "3.9"
|
|
13
|
-
|
|
14
|
-
# 📦 ai-pack
|
|
15
|
-
|
|
16
|
-
[](https://www.python.org/)
|
|
17
|
-
[](LICENSE)
|
|
18
|
-
[](https://badge.fury.io/py/ai-pack-cli)
|
|
19
|
-
[](https://github.com/)
|
|
20
|
-
[](https://github.com/iamraydoan/ai-pack)
|
|
21
|
-
|
|
22
|
-
> Pack your entire codebase into a single formatted Markdown prompt for LLMs, optimized for minimum tokens.
|
|
23
|
-
|
|
24
|
-
`ai-pack` is a lightweight, high-performance CLI tool designed to help developers package their codebase, specific files, or uncommitted changes into a clean Markdown payload. Easily copy it to the clipboard or save it to a file to feed directly into ChatGPT, Claude, Gemini, or any other LLM.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 🔥 Key Features
|
|
29
|
-
|
|
30
|
-
* **⚡ Native CLI Command**: Accessible globally as `ai-pack`, `aipack`, or `aip`.
|
|
31
|
-
* **💀 Code Skeleton Extraction (`--skeleton`)**: Drastically save tokens by stripping method and function bodies, keeping only class structures, imports, signatures, and docstrings.
|
|
32
|
-
* **🎯 Interactive Selection (`-i`)**: Interactively choose which files to pack using Arrow keys and Spacebar before generating the payload.
|
|
33
|
-
* **🌿 Git-Aware (`--changed`)**: Automatically detect and pack only modified, staged, or untracked files.
|
|
34
|
-
* **🛡️ Gitignore Respecting**: Native Git integration using `git ls-files` to automatically ignore build artifacts, node modules, and everything in `.gitignore` (with a clean manual fallback for non-git folders).
|
|
35
|
-
* **💬 Predefined LLM Prompts (`-p`)**: Instantly prepend pre-configured prompts for code review, bug hunting, or architecture explanations.
|
|
36
|
-
* **📊 Token Estimation**: Heuristic token counting warns you if your payload exceeds your limit (`--max-tokens`).
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 🚀 Quick Start
|
|
41
|
-
|
|
42
|
-
### Installation
|
|
43
|
-
|
|
44
|
-
Choose one of the following methods to get started quickly:
|
|
45
|
-
|
|
46
|
-
#### Option 1: Install from PyPI (Recommended)
|
|
47
|
-
Install the official release from PyPI:
|
|
48
|
-
```bash
|
|
49
|
-
pip3 install ai-pack-cli --user
|
|
50
|
-
```
|
|
51
|
-
Or via `pipx` to run in an isolated environment:
|
|
52
|
-
```bash
|
|
53
|
-
pipx install ai-pack-cli
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### Option 2: Install directly from GitHub
|
|
57
|
-
Install the latest cutting-edge development version directly:
|
|
58
|
-
```bash
|
|
59
|
-
pip3 install git+https://github.com/iamraydoan/ai-pack.git --user
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
#### Option 3: Manual Clone (Editable mode)
|
|
63
|
-
If you want to modify the source code:
|
|
64
|
-
```bash
|
|
65
|
-
git clone https://github.com/iamraydoan/ai-pack.git
|
|
66
|
-
cd ai-pack
|
|
67
|
-
pip3 install -e . --user
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
#### Option 4: Run as a Standalone Script (One-Liner)
|
|
71
|
-
Since `ai-pack` is a self-contained single script, you can download it directly:
|
|
72
|
-
```bash
|
|
73
|
-
curl -o ~/.local/bin/aip https://raw.githubusercontent.com/iamraydoan/ai-pack/main/ai_pack.py && chmod +x ~/.local/bin/aip
|
|
74
|
-
```
|
|
75
|
-
*(Note: If you run it standalone, you will need to manually run `pip3 install pyperclip questionary` to enable all optional interactive and clipboard features).*
|
|
76
|
-
|
|
77
|
-
> [!TIP]
|
|
78
|
-
> **Optional backend for Skeleton Mode (`--skeleton`)**:
|
|
79
|
-
> If you plan to use skeleton extraction for non-Python languages (such as JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin), you must install `ast-grep` globally:
|
|
80
|
-
> ```bash
|
|
81
|
-
> npm install -g @ast-grep/cli
|
|
82
|
-
> # or: cargo install ast-grep
|
|
83
|
-
> ```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### Usage Examples
|
|
87
|
-
|
|
88
|
-
#### 1. Pack the entire repository (copied to clipboard)
|
|
89
|
-
```bash
|
|
90
|
-
aip
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
#### 2. Pack specific files and save to a file
|
|
94
|
-
```bash
|
|
95
|
-
aip -f src/main.py tests/ -o output.md
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### 3. Pack only uncommitted git changes with a code review prompt
|
|
99
|
-
```bash
|
|
100
|
-
aip --changed -p review
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
#### 4. Extract code skeleton only (drastically saves context window tokens)
|
|
104
|
-
```bash
|
|
105
|
-
aip --skeleton -p explain
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
#### 5. Interactively choose files to include
|
|
109
|
-
```bash
|
|
110
|
-
aip -i
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 💀 Skeleton Mode Demo
|
|
116
|
-
|
|
117
|
-
### Original Code (`math.py`):
|
|
118
|
-
```python
|
|
119
|
-
def fibonacci(n):
|
|
120
|
-
if n <= 0:
|
|
121
|
-
return []
|
|
122
|
-
elif n == 1:
|
|
123
|
-
return [0]
|
|
124
|
-
sequence = [0, 1]
|
|
125
|
-
while len(sequence) < n:
|
|
126
|
-
sequence.append(sequence[-1] + sequence[-2])
|
|
127
|
-
return sequence
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Skeleton Output:
|
|
131
|
-
```python
|
|
132
|
-
def fibonacci(n):
|
|
133
|
-
...
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
*Supports Python, JavaScript, TypeScript, Go, Rust, Java, C#, C++, PHP, Lua, CSS, Swift, and Kotlin via codesigs and ast-grep.*
|
|
137
|
-
|
|
138
|
-
> [!IMPORTANT]
|
|
139
|
-
> **Skeleton Mode Dependencies**:
|
|
140
|
-
> * **Python >= 3.9**: Required to run the `--skeleton` feature.
|
|
141
|
-
> * **ast-grep**: For non-Python languages, the `ast-grep` command-line tool must be installed globally (e.g. via npm: `npm install -g @ast-grep/cli` or cargo: `cargo install ast-grep`).
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## 🎨 Interactive CLI Checklist
|
|
146
|
-
|
|
147
|
-
Running `aip -i` triggers a beautiful checkbox prompt:
|
|
148
|
-
|
|
149
|
-
```text
|
|
150
|
-
? Select files to pack (Space to toggle, Enter to confirm):
|
|
151
|
-
❯ [x] src/main.py
|
|
152
|
-
[x] src/utils.py
|
|
153
|
-
[ ] tests/test_main.py
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## 🤝 Contributing
|
|
159
|
-
|
|
160
|
-
Contributions are welcome! If you have ideas for new features, bug fixes, or enhancements:
|
|
161
|
-
|
|
162
|
-
1. Fork the repo.
|
|
163
|
-
2. Create your feature branch (`git checkout -b feat/amazing-feature`).
|
|
164
|
-
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
165
|
-
4. Push to the branch (`git push origin feat/amazing-feature`).
|
|
166
|
-
5. Open a Pull Request.
|
|
167
|
-
|
|
168
|
-
**Don't forget to give the project a ⭐ if you found it useful!**
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|