loq 0.1.0__py3-none-win_amd64.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.
- LICENSE +21 -0
- loq/__init__.py +3 -0
- loq/__main__.py +63 -0
- loq-0.1.0.data/scripts/loq.exe +0 -0
- loq-0.1.0.dist-info/METADATA +154 -0
- loq-0.1.0.dist-info/RECORD +9 -0
- loq-0.1.0.dist-info/WHEEL +4 -0
- loq-0.1.0.dist-info/licenses/LICENSE +21 -0
- loq-0.1.0.dist-info/sboms/loq.cyclonedx.json +2517 -0
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jake Kaplan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
loq/__init__.py
ADDED
loq/__main__.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Binary wrapper for loq.
|
|
2
|
+
|
|
3
|
+
Finds and executes the loq binary, handling various installation scenarios.
|
|
4
|
+
Based on the pattern used by ruff and uv.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
import sys
|
|
11
|
+
import sysconfig
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def find_loq_bin() -> str:
|
|
15
|
+
"""Find the loq binary."""
|
|
16
|
+
loq_exe = "loq.exe" if sys.platform == "win32" else "loq"
|
|
17
|
+
|
|
18
|
+
# First, check the scripts directory (standard pip install)
|
|
19
|
+
scripts_dir = sysconfig.get_path("scripts")
|
|
20
|
+
if scripts_dir:
|
|
21
|
+
candidate = os.path.join(scripts_dir, loq_exe)
|
|
22
|
+
if os.path.isfile(candidate):
|
|
23
|
+
return candidate
|
|
24
|
+
|
|
25
|
+
# Check user scripts directory
|
|
26
|
+
user_scheme = "nt_user" if os.name == "nt" else "posix_user"
|
|
27
|
+
user_scripts = sysconfig.get_path("scripts", scheme=user_scheme)
|
|
28
|
+
if user_scripts:
|
|
29
|
+
candidate = os.path.join(user_scripts, loq_exe)
|
|
30
|
+
if os.path.isfile(candidate):
|
|
31
|
+
return candidate
|
|
32
|
+
|
|
33
|
+
# Check sibling bin directory (pip install --target)
|
|
34
|
+
package_dir = os.path.dirname(__file__)
|
|
35
|
+
candidate = os.path.join(package_dir, "..", "..", "bin", loq_exe)
|
|
36
|
+
if os.path.isfile(candidate):
|
|
37
|
+
return os.path.abspath(candidate)
|
|
38
|
+
|
|
39
|
+
# Check pip build environment overlay
|
|
40
|
+
if sys.prefix != sys.base_prefix:
|
|
41
|
+
scripts = "Scripts" if os.name == "nt" else "bin"
|
|
42
|
+
candidate = os.path.join(sys.prefix, scripts, loq_exe)
|
|
43
|
+
if os.path.isfile(candidate):
|
|
44
|
+
return candidate
|
|
45
|
+
|
|
46
|
+
raise FileNotFoundError(f"Could not find {loq_exe}")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def main() -> None:
|
|
50
|
+
"""Run the loq CLI."""
|
|
51
|
+
loq = find_loq_bin()
|
|
52
|
+
|
|
53
|
+
if sys.platform == "win32":
|
|
54
|
+
import subprocess
|
|
55
|
+
|
|
56
|
+
result = subprocess.run([loq, *sys.argv[1:]])
|
|
57
|
+
sys.exit(result.returncode)
|
|
58
|
+
else:
|
|
59
|
+
os.execvp(loq, [loq, *sys.argv[1:]])
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
main()
|
|
Binary file
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loq
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Rust
|
|
17
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Summary: Enforce file size constraints
|
|
20
|
+
Keywords: linter,code-quality,file-size,loc,lines-of-code
|
|
21
|
+
Author-email: Jake Kaplan <jakegkaplan@gmail.com>
|
|
22
|
+
License: MIT
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
25
|
+
Project-URL: Repository, https://github.com/jakekaplan/loq
|
|
26
|
+
|
|
27
|
+
# loq
|
|
28
|
+
|
|
29
|
+
[](https://github.com/jakekaplan/loq/actions/workflows/ci.yml)
|
|
30
|
+
[](https://codecov.io/gh/jakekaplan/loq)
|
|
31
|
+
[](https://pypi.org/project/loq/)
|
|
32
|
+
[](https://crates.io/crates/loq)
|
|
33
|
+
[](LICENSE)
|
|
34
|
+
|
|
35
|
+
An electric fence for LLMs (and humans too). Written in Rust,
|
|
36
|
+
`loq` enforces file line limits: fast, works out of the box, and language agnostic.
|
|
37
|
+
|
|
38
|
+
## Why loq?
|
|
39
|
+
- 🔒 Hard limits to prevent oversized files and context rot
|
|
40
|
+
- 📏 One metric: line counts (`wc -l` style)
|
|
41
|
+
- 🧩 Works everywhere - no language-specific setup
|
|
42
|
+
- 🤖 Designed specifically with coding agents in mind
|
|
43
|
+
- 🦀 Lightning fast Rust core
|
|
44
|
+
|
|
45
|
+
## Getting Started
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
48
|
+
```bash
|
|
49
|
+
# With uv (recommended)
|
|
50
|
+
uv tool install loq
|
|
51
|
+
|
|
52
|
+
# With pip
|
|
53
|
+
pip install loq
|
|
54
|
+
|
|
55
|
+
# With cargo
|
|
56
|
+
cargo install loq
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Usage
|
|
60
|
+
```bash
|
|
61
|
+
# Check current directory for violations (default: 500 lines)
|
|
62
|
+
loq check
|
|
63
|
+
|
|
64
|
+
# Check specific paths
|
|
65
|
+
loq check src/ lib/
|
|
66
|
+
|
|
67
|
+
# Check only staged files
|
|
68
|
+
loq check --staged
|
|
69
|
+
|
|
70
|
+
# Check files changed since a ref
|
|
71
|
+
loq check --diff HEAD
|
|
72
|
+
loq check --diff origin/main..HEAD
|
|
73
|
+
|
|
74
|
+
# Check files from stdin
|
|
75
|
+
git diff --name-only | loq check -
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`--staged` and `--diff` are repo-wide modes. They cannot be combined with
|
|
79
|
+
`PATH` args or stdin scope (`loq check -`).
|
|
80
|
+
|
|
81
|
+
### Managing legacy files
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Creates, updates or removes exact-path rules
|
|
85
|
+
# to match the current state of your files.
|
|
86
|
+
loq baseline
|
|
87
|
+
|
|
88
|
+
# Creates or updates exact-path rules for current violations
|
|
89
|
+
loq relax
|
|
90
|
+
loq relax src/legacy.rs # specific file
|
|
91
|
+
loq relax --extra 50 # custom buffer
|
|
92
|
+
|
|
93
|
+
# Ratchets down or removes existing exact-path rules
|
|
94
|
+
# as your file sizes become compliant over time
|
|
95
|
+
loq tighten
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
All three commands manage exact-path rules in `loq.toml`. `baseline` and
|
|
99
|
+
`relax` can add new rules; `tighten` only updates or removes existing ones.
|
|
100
|
+
|
|
101
|
+
## Configuration
|
|
102
|
+
|
|
103
|
+
loq works zero-config. Run `loq init` to create a `loq.toml` file to customize:
|
|
104
|
+
|
|
105
|
+
```toml
|
|
106
|
+
# default, for files not matching any rule
|
|
107
|
+
default_max_lines = 500
|
|
108
|
+
|
|
109
|
+
# skip .gitignore'd files
|
|
110
|
+
respect_gitignore = true
|
|
111
|
+
|
|
112
|
+
# ignore files or paths
|
|
113
|
+
exclude = [".git/**", "**/generated/**", "*.lock"]
|
|
114
|
+
|
|
115
|
+
# Add fix_guidance to include project-specific instructions
|
|
116
|
+
# with each violation when piping output to an LLM:
|
|
117
|
+
fix_guidance = "Split large files: helpers → src/utils/, types → src/types/"
|
|
118
|
+
|
|
119
|
+
# Last match wins
|
|
120
|
+
# * stays within a path segment
|
|
121
|
+
# ** matches across directories
|
|
122
|
+
[[rules]]
|
|
123
|
+
path = "**/*.tsx"
|
|
124
|
+
max_lines = 300
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Output options
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Detailed output
|
|
131
|
+
loq check -v
|
|
132
|
+
|
|
133
|
+
# JSON format
|
|
134
|
+
loq check --output-format json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Add as a Pre-commit Hook
|
|
138
|
+
|
|
139
|
+
```yaml
|
|
140
|
+
repos:
|
|
141
|
+
- repo: https://github.com/jakekaplan/loq
|
|
142
|
+
rev: v0.1.0
|
|
143
|
+
hooks:
|
|
144
|
+
- id: loq
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Contributing
|
|
148
|
+
|
|
149
|
+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
154
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
LICENSE,sha256=ECGosnJUqh_JLoh86b4mkgpGq_2uG6js80BF0ZL9PGk,1089
|
|
2
|
+
loq/__init__.py,sha256=8WSMdIzSemjZB1o5sFguivaC8v6Pe1sdxdg3ijnKVM0,70
|
|
3
|
+
loq/__main__.py,sha256=HA8neim-DG80-w080cfM1FmE-K8kvGnuJ4vIMl0U1WY,1873
|
|
4
|
+
loq-0.1.0.data/scripts/loq.exe,sha256=f84tgV9GpD6-yKOEC0NTavdH2Ky8iJJn8Yj9Usf3aQg,3132416
|
|
5
|
+
loq-0.1.0.dist-info/METADATA,sha256=JVXH0-r_e_0IsSDdfFOLQHAAAIyZnbdY95oPuO0jiRQ,4358
|
|
6
|
+
loq-0.1.0.dist-info/WHEEL,sha256=uJOc2U-Q1x95AlblQcqMRb3iR4QnPtdI7X2ycPN99rM,94
|
|
7
|
+
loq-0.1.0.dist-info/licenses/LICENSE,sha256=ECGosnJUqh_JLoh86b4mkgpGq_2uG6js80BF0ZL9PGk,1089
|
|
8
|
+
loq-0.1.0.dist-info/sboms/loq.cyclonedx.json,sha256=Ri--OEKVZ2LRj26erGk1qA1fSsUze0fO0avFe6ZG3Zs,77863
|
|
9
|
+
loq-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jake Kaplan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|