sack-cli 0.5.0__py3-none-any.whl
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.
- sack/__init__.py +2 -0
- sack/__main__.py +4 -0
- sack/cli.py +827 -0
- sack_cli-0.5.0.dist-info/METADATA +126 -0
- sack_cli-0.5.0.dist-info/RECORD +9 -0
- sack_cli-0.5.0.dist-info/WHEEL +5 -0
- sack_cli-0.5.0.dist-info/entry_points.txt +2 -0
- sack_cli-0.5.0.dist-info/licenses/LICENSE +648 -0
- sack_cli-0.5.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sack-cli
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Lightweight source-context extractor for AI-assisted software development
|
|
5
|
+
Author: Sadaqat Ali
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# SACK — Sadaqat Ali Context Hack
|
|
13
|
+
|
|
14
|
+
[](https://www.python.org/)
|
|
15
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
16
|
+
[](#)
|
|
17
|
+
[](#)
|
|
18
|
+
|
|
19
|
+
A zero-runtime-dependency CLI that builds a **compact, high-density structural context index** for AI-assisted software development.
|
|
20
|
+
|
|
21
|
+
Feeding entire source trees to LLMs (Claude, GPT-4o, Gemini, DeepSeek, Cursor) burns tens of thousands of tokens on implementation details, markup, and boilerplate. **SACK** extracts public APIs, types, signatures, dependency graphs, and framework-level contracts—slashing token consumption by **80–90%** while giving AI models exact architectural clarity.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ⚡ Key Features
|
|
26
|
+
|
|
27
|
+
- **14+ Languages & Stacks**: Python (AST-grade), TypeScript, JavaScript, Svelte (4 & 5), Vue, Flutter/Dart, Rust, Go, C/C++, Java, PHP, C#, Kotlin, Swift, and Ruby.
|
|
28
|
+
- **Framework & IPC Intelligence**:
|
|
29
|
+
- **Svelte**: Extracts Svelte 4 props, Svelte 5 Runes (`$props()`, `$state()`, `$derived()`), emitted events, and **Tauri IPC** calls (`invoke`, `listen`, `emit`).
|
|
30
|
+
- **Rust**: Preserves attributes such as `#[tauri::command]` and `#[derive(...)]`.
|
|
31
|
+
- **Flutter & Dart**: Extracts widgets, constructors, null-safety types, annotations (`@override`, `@immutable`), and resolves `package:...` imports.
|
|
32
|
+
- **C# / .NET**: Extracts classes, interfaces, records, methods, and attributes (`[ApiController]`, `[HttpGet]`).
|
|
33
|
+
- **Kotlin**: Data classes, suspend functions, and `@Composable` annotations.
|
|
34
|
+
- **Swift**: Structs, protocols, and property wrappers (`@State`, `@Binding`).
|
|
35
|
+
- **Dependency Topology Graph**: Automatically maps project-relative internal imports into a dependency overview.
|
|
36
|
+
- **Smart Filtering**: Automatically ignores build artifacts, minified files (`*.min.js`), and machine-generated code (`*.g.dart`, `*.designer.cs`, `*.pb.go`).
|
|
37
|
+
- **Token & Size Metrics**: Reports lines, kilobytes, and approximate token counts on every scan.
|
|
38
|
+
- **Incremental Caching**: `--changed` flag re-indexes only modified files using local mtime caches (`.sack_cache.json`).
|
|
39
|
+
- **AI Coding Guardrails**: Generates `sack_guardrails.md` tailored with language-specific best practices for LLMs.
|
|
40
|
+
- **Zero Runtime Dependencies**: Built entirely with Python's standard library.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🚀 Installation
|
|
45
|
+
|
|
46
|
+
Install directly from checkout or local clone:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone git clone https://github.com/SadaatAliCoder/sack.git
|
|
50
|
+
cd sack
|
|
51
|
+
python -m pip install .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
For development in editable mode:
|
|
55
|
+
```bash
|
|
56
|
+
python -m pip install -e .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 🛠️ Commands
|
|
62
|
+
|
|
63
|
+
| Command | Description |
|
|
64
|
+
| :--- | :--- |
|
|
65
|
+
| `sack scan` | Full scan of current directory, updates cache, and generates `sack_context.txt`. |
|
|
66
|
+
| `sack scan --changed` | Re-extracts only new or modified files using cached mtimes; preserves unchanged files. |
|
|
67
|
+
| `sack scan --root /path` | Scans a specified project root directory. |
|
|
68
|
+
| `sack init` | Creates `sack_guardrails.md` with language-specific rules for AI models. |
|
|
69
|
+
| `sack init --force` | Overwrites existing `sack_guardrails.md`. |
|
|
70
|
+
| `sack --version` | Displays current SACK version. |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 📋 Supported Languages & Capabilities
|
|
75
|
+
|
|
76
|
+
| Language / Stack | File Extensions | Extracted Elements |
|
|
77
|
+
| :--- | :--- | :--- |
|
|
78
|
+
| **Python** | `.py` | AST parsing, multiline signatures, types, decorators, docstrings |
|
|
79
|
+
| **JavaScript / TypeScript** | `.js`, `.jsx`, `.ts`, `.tsx`, `.mjs`, `.cjs` | Imports, interfaces, types, enums, classes, arrow functions, JSDoc |
|
|
80
|
+
| **Svelte** | `.svelte` | Svelte 4 props, Svelte 5 Runes (`$props`, `$state`, `$derived`), Tauri IPC (`invoke`), events |
|
|
81
|
+
| **Vue** | `.vue` | `<script>` & `<script setup lang="ts">` declarations, imports |
|
|
82
|
+
| **Flutter & Dart** | `.dart` | Classes, widgets, constructors, functions, `@override`, `package:...` resolution |
|
|
83
|
+
| **Rust** | `.rs` | Functions, structs, traits, `#[tauri::command]` and attributes |
|
|
84
|
+
| **C#** | `.cs` | `using`, namespaces, classes, interfaces, records, attributes (`[Route]`) |
|
|
85
|
+
| **Kotlin** | `.kt`, `.kts` | `package`, data classes, suspend functions, `@Composable` |
|
|
86
|
+
| **Swift** | `.swift` | Structs, protocols, functions, `@State`, `@Binding`, property wrappers |
|
|
87
|
+
| **Ruby** | `.rb` | `require`, classes, modules, methods (`def`), constants |
|
|
88
|
+
| **Go** | `.go` | Packages, imports, structs, interfaces, functions |
|
|
89
|
+
| **C / C++** | `.c`, `.cpp`, `.h`, `.hpp`, etc. | Headers, classes, templates, function prototypes |
|
|
90
|
+
| **Java** | `.java` | Packages, imports, classes, interfaces, records, annotations |
|
|
91
|
+
| **PHP** | `.php` | Namespaces, classes, interfaces, traits, methods, PHPDoc |
|
|
92
|
+
| **Markup & Styles** | `.html`, `.css`, `.scss` | High-level line summaries (omits noisy DOM/CSS) |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 🤖 How to Use with AI Models
|
|
97
|
+
|
|
98
|
+
When asking an AI model (ChatGPT, Claude, Gemini, Cursor) to write or refactor code in your project:
|
|
99
|
+
|
|
100
|
+
1. Run `sack scan` in your project root to generate `sack_context.txt`.
|
|
101
|
+
2. Attach or paste `sack_context.txt` into your prompt:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
Here is the structural context index of my project generated by SACK:
|
|
105
|
+
|
|
106
|
+
<context>
|
|
107
|
+
[PASTE sack_context.txt HERE]
|
|
108
|
+
</context>
|
|
109
|
+
|
|
110
|
+
Task: Add a new user profile settings feature.
|
|
111
|
+
Follow the architectural patterns and existing APIs outlined in the context above.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The AI model receives complete awareness of existing component APIs, Tauri IPC calls, and dependency graphs—without filling up context limits.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🛡️ AI Guardrails (`sack init`)
|
|
119
|
+
|
|
120
|
+
Run `sack init` to create a `sack_guardrails.md` file in your repository. This file instructs AI models on universal and language-specific coding standards (PEP 257 for Python, sound null safety for Dart/Flutter, strict IPC typing for Tauri, const constructors, etc.).
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 📄 License
|
|
125
|
+
|
|
126
|
+
GNU General Public License v3.0 (GPL-3.0) © 2026 Sadaqat Ali. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
sack/__init__.py,sha256=3-bwXyylt41OM9DLBFMUAmiwkZBIlMFg4W_4MeX_RFI,60
|
|
2
|
+
sack/__main__.py,sha256=ryB44AlJ-iODDTIKDUW0AaGGTY5MUg5uo0yo1G7CNq0,118
|
|
3
|
+
sack/cli.py,sha256=4TgeEki8TAejz7oVeKo7E8Dy9W2t5iJ7jP92VxVCGpQ,39606
|
|
4
|
+
sack_cli-0.5.0.dist-info/licenses/LICENSE,sha256=FrRNlUoEExTV3WmZlaHa1gk_YsKT2mQ0DLHTy7fCGts,33749
|
|
5
|
+
sack_cli-0.5.0.dist-info/METADATA,sha256=l8fSdVyrgLdwBZUn6VjGjs2ILCWIjPHTduUmfxBUxiY,6456
|
|
6
|
+
sack_cli-0.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
7
|
+
sack_cli-0.5.0.dist-info/entry_points.txt,sha256=L1khkUBAD9h7taH5d9PYAZpmBczD3w2FQobyw8oh3Mg,39
|
|
8
|
+
sack_cli-0.5.0.dist-info/top_level.txt,sha256=AtkiUKgmxw4GRpvy1CsG-HzLHX4kan8niYLXkv7xG-Q,5
|
|
9
|
+
sack_cli-0.5.0.dist-info/RECORD,,
|