loopflow 0.1.0__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.
- loopflow-0.1.0/LICENSE +21 -0
- loopflow-0.1.0/PKG-INFO +154 -0
- loopflow-0.1.0/README.md +136 -0
- loopflow-0.1.0/pyproject.toml +44 -0
- loopflow-0.1.0/setup.cfg +4 -0
- loopflow-0.1.0/src/lf/__init__.py +0 -0
- loopflow-0.1.0/src/lf/cli.py +36 -0
- loopflow-0.1.0/src/lf/cp/__init__.py +1 -0
- loopflow-0.1.0/src/lf/cp/cli.py +385 -0
- loopflow-0.1.0/src/lf/cp/file.py +693 -0
- loopflow-0.1.0/src/lf/cp/token_profiler.py +588 -0
- loopflow-0.1.0/src/lf/git.py +98 -0
- loopflow-0.1.0/src/loopflow.egg-info/PKG-INFO +154 -0
- loopflow-0.1.0/src/loopflow.egg-info/SOURCES.txt +16 -0
- loopflow-0.1.0/src/loopflow.egg-info/dependency_links.txt +1 -0
- loopflow-0.1.0/src/loopflow.egg-info/entry_points.txt +3 -0
- loopflow-0.1.0/src/loopflow.egg-info/requires.txt +5 -0
- loopflow-0.1.0/src/loopflow.egg-info/top_level.txt +1 -0
loopflow-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Loopflow Studio
|
|
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.
|
loopflow-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loopflow
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Arrange LLMs to code in harmony
|
|
5
|
+
Author-email: Jack Heart <jack@loopflow.studio>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/loopflowstudio/loopflow
|
|
8
|
+
Project-URL: Repository, https://github.com/loopflowstudio/loopflow
|
|
9
|
+
Project-URL: Issues, https://github.com/loopflowstudio/loopflow/issues
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: typer>=0.9.0
|
|
14
|
+
Requires-Dist: tiktoken>=0.9.0
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=9.0.0; extra == "dev"
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# lfcp
|
|
20
|
+
|
|
21
|
+
A tool for copying codebase context to clipboard for LLM interactions.
|
|
22
|
+
|
|
23
|
+
## Overview
|
|
24
|
+
|
|
25
|
+
lfcp gathers files into context for LLM queries, building on e.g. `files-to-prompt`.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- **Smart Context Gathering**: Automatically includes parent README files up to git root
|
|
30
|
+
- **Gitignore Integration**: Respects `.gitignore` and `.cpignore` patterns
|
|
31
|
+
- **Extension Filtering**: Focus on specific file types with `-e` flags
|
|
32
|
+
- **Token Profiling**: Analyze token usage with detailed breakdowns and interactive flamegraphs
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install lf
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or install from source:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/loopflowstudio/loopflow.git
|
|
44
|
+
cd loopflow
|
|
45
|
+
uv venv
|
|
46
|
+
uv pip install -e .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
### Basic Usage
|
|
53
|
+
|
|
54
|
+
Copy the current directory to clipboard:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
lfcp .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Common Workflows
|
|
61
|
+
|
|
62
|
+
Copy specific directories:
|
|
63
|
+
```bash
|
|
64
|
+
lfcp src/ tests/
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Copy only Python files:
|
|
68
|
+
```bash
|
|
69
|
+
lfcp . -e py
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Copy multiple file types:
|
|
73
|
+
```bash
|
|
74
|
+
lfcp . -e py -e js -e tsx
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Output to stdout instead of clipboard:
|
|
78
|
+
```bash
|
|
79
|
+
lfcp . -s
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Copy only README files (great for project overview):
|
|
83
|
+
```bash
|
|
84
|
+
lfcp . -r
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Ignore specific directories:
|
|
88
|
+
```bash
|
|
89
|
+
lfcp . -i build -i dist
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Token Profiling
|
|
93
|
+
|
|
94
|
+
Analyze token usage across your codebase:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
lfcp . --profile
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Generate an interactive flamegraph visualization:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
lfcp . --flamegraph
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The flamegraph will be saved as `token_flamegraph.html` and can be opened in any browser.
|
|
107
|
+
|
|
108
|
+
### Advanced Options
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Options:
|
|
112
|
+
-e, --extensions TEXT Filter by file extension (e.g., -e py -e js)
|
|
113
|
+
-r, --readmes Only include README files
|
|
114
|
+
-s, --stdout Output to stdout instead of clipboard
|
|
115
|
+
-i, --ignore TEXT Additional ignore patterns (can be used multiple times)
|
|
116
|
+
--profile Show detailed token usage statistics
|
|
117
|
+
--flamegraph Generate interactive HTML flamegraph visualization
|
|
118
|
+
--help Show help message
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## How It Works
|
|
122
|
+
|
|
123
|
+
1. **Discovery**: Walks through specified directories, respecting gitignore rules
|
|
124
|
+
2. **Context Addition**: Automatically includes parent README files for better context
|
|
125
|
+
3. **Filtering**: Applies extension filters and ignore patterns
|
|
126
|
+
4. **Formatting**: Structures files in XML format with clear source attribution
|
|
127
|
+
5. **Output**: Copies to clipboard or outputs to stdout based on your preference
|
|
128
|
+
|
|
129
|
+
## File Format
|
|
130
|
+
|
|
131
|
+
```xml
|
|
132
|
+
<documents>
|
|
133
|
+
<document index="1">
|
|
134
|
+
<source>path/to/file.py</source>
|
|
135
|
+
<document_content>
|
|
136
|
+
# Your file content here
|
|
137
|
+
</document_content>
|
|
138
|
+
</document>
|
|
139
|
+
</documents>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Gitignore Support
|
|
143
|
+
|
|
144
|
+
lf respects both `.gitignore` and `.cpignore` files. You can create a `.cpignore` in your project root to specify additional patterns to ignore when gathering code context:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
# Example .cpignore
|
|
148
|
+
*.pyc
|
|
149
|
+
__pycache__/
|
|
150
|
+
node_modules/
|
|
151
|
+
*.egg-info
|
|
152
|
+
build/
|
|
153
|
+
dist/
|
|
154
|
+
```
|
loopflow-0.1.0/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# lfcp
|
|
2
|
+
|
|
3
|
+
A tool for copying codebase context to clipboard for LLM interactions.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
lfcp gathers files into context for LLM queries, building on e.g. `files-to-prompt`.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Smart Context Gathering**: Automatically includes parent README files up to git root
|
|
12
|
+
- **Gitignore Integration**: Respects `.gitignore` and `.cpignore` patterns
|
|
13
|
+
- **Extension Filtering**: Focus on specific file types with `-e` flags
|
|
14
|
+
- **Token Profiling**: Analyze token usage with detailed breakdowns and interactive flamegraphs
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install lf
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or install from source:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/loopflowstudio/loopflow.git
|
|
26
|
+
cd loopflow
|
|
27
|
+
uv venv
|
|
28
|
+
uv pip install -e .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
Copy the current directory to clipboard:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
lfcp .
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Common Workflows
|
|
43
|
+
|
|
44
|
+
Copy specific directories:
|
|
45
|
+
```bash
|
|
46
|
+
lfcp src/ tests/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Copy only Python files:
|
|
50
|
+
```bash
|
|
51
|
+
lfcp . -e py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Copy multiple file types:
|
|
55
|
+
```bash
|
|
56
|
+
lfcp . -e py -e js -e tsx
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Output to stdout instead of clipboard:
|
|
60
|
+
```bash
|
|
61
|
+
lfcp . -s
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Copy only README files (great for project overview):
|
|
65
|
+
```bash
|
|
66
|
+
lfcp . -r
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Ignore specific directories:
|
|
70
|
+
```bash
|
|
71
|
+
lfcp . -i build -i dist
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Token Profiling
|
|
75
|
+
|
|
76
|
+
Analyze token usage across your codebase:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
lfcp . --profile
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Generate an interactive flamegraph visualization:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
lfcp . --flamegraph
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The flamegraph will be saved as `token_flamegraph.html` and can be opened in any browser.
|
|
89
|
+
|
|
90
|
+
### Advanced Options
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Options:
|
|
94
|
+
-e, --extensions TEXT Filter by file extension (e.g., -e py -e js)
|
|
95
|
+
-r, --readmes Only include README files
|
|
96
|
+
-s, --stdout Output to stdout instead of clipboard
|
|
97
|
+
-i, --ignore TEXT Additional ignore patterns (can be used multiple times)
|
|
98
|
+
--profile Show detailed token usage statistics
|
|
99
|
+
--flamegraph Generate interactive HTML flamegraph visualization
|
|
100
|
+
--help Show help message
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## How It Works
|
|
104
|
+
|
|
105
|
+
1. **Discovery**: Walks through specified directories, respecting gitignore rules
|
|
106
|
+
2. **Context Addition**: Automatically includes parent README files for better context
|
|
107
|
+
3. **Filtering**: Applies extension filters and ignore patterns
|
|
108
|
+
4. **Formatting**: Structures files in XML format with clear source attribution
|
|
109
|
+
5. **Output**: Copies to clipboard or outputs to stdout based on your preference
|
|
110
|
+
|
|
111
|
+
## File Format
|
|
112
|
+
|
|
113
|
+
```xml
|
|
114
|
+
<documents>
|
|
115
|
+
<document index="1">
|
|
116
|
+
<source>path/to/file.py</source>
|
|
117
|
+
<document_content>
|
|
118
|
+
# Your file content here
|
|
119
|
+
</document_content>
|
|
120
|
+
</document>
|
|
121
|
+
</documents>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Gitignore Support
|
|
125
|
+
|
|
126
|
+
lf respects both `.gitignore` and `.cpignore` files. You can create a `.cpignore` in your project root to specify additional patterns to ignore when gathering code context:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
# Example .cpignore
|
|
130
|
+
*.pyc
|
|
131
|
+
__pycache__/
|
|
132
|
+
node_modules/
|
|
133
|
+
*.egg-info
|
|
134
|
+
build/
|
|
135
|
+
dist/
|
|
136
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools==80.9.0", "wheel==0.45.1"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "loopflow"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Arrange LLMs to code in harmony"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
dependencies = ["typer>=0.9.0", "tiktoken>=0.9.0"]
|
|
12
|
+
license = {text = "MIT"}
|
|
13
|
+
authors = [
|
|
14
|
+
{name = "Jack Heart", email = "jack@loopflow.studio"}
|
|
15
|
+
]
|
|
16
|
+
keywords = []
|
|
17
|
+
classifiers = []
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://github.com/loopflowstudio/loopflow"
|
|
21
|
+
Repository = "https://github.com/loopflowstudio/loopflow"
|
|
22
|
+
Issues = "https://github.com/loopflowstudio/loopflow/issues"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = ["pytest>=9.0.0"]
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
lf = "lf.cli:app"
|
|
29
|
+
lfcp = "lf.cp.cli:app"
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["src"]
|
|
33
|
+
include = ["lf", "lf.*"]
|
|
34
|
+
|
|
35
|
+
[tool.pytest.ini_options]
|
|
36
|
+
pythonpath = ["src"]
|
|
37
|
+
testpaths = ["tests"]
|
|
38
|
+
python_files = ["test_*.py"]
|
|
39
|
+
python_functions = ["test_*"]
|
|
40
|
+
python_classes = ["Test*"]
|
|
41
|
+
|
|
42
|
+
[tool.coverage.run]
|
|
43
|
+
source = ["lf"]
|
|
44
|
+
|
loopflow-0.1.0/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Main CLI entry point for lf."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
app = typer.Typer(
|
|
8
|
+
name="lf",
|
|
9
|
+
help="loopflow - arrange LLMs to code in harmony",
|
|
10
|
+
no_args_is_help=True,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from lf.cp.cli import app as cp_app
|
|
14
|
+
|
|
15
|
+
@app.command()
|
|
16
|
+
def cp(ctx: typer.Context):
|
|
17
|
+
"""Arrange codebase context for LLM interactions (alias for lfcp).
|
|
18
|
+
|
|
19
|
+
This command is an alias that invokes lfcp with the same arguments.
|
|
20
|
+
All arguments after 'cp' are passed directly to lfcp.
|
|
21
|
+
"""
|
|
22
|
+
# Import here to avoid circular dependencies
|
|
23
|
+
# Get all remaining arguments from sys.argv
|
|
24
|
+
# Find the index of 'cp' and pass everything after it
|
|
25
|
+
try:
|
|
26
|
+
cp_index = sys.argv.index('cp')
|
|
27
|
+
remaining_args = sys.argv[cp_index + 1:]
|
|
28
|
+
except ValueError:
|
|
29
|
+
remaining_args = []
|
|
30
|
+
|
|
31
|
+
# Invoke the clip app with remaining arguments
|
|
32
|
+
cp_app(remaining_args, standalone_mode=False)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if __name__ == "__main__":
|
|
36
|
+
app()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""cp - Copy codebase context to clipboard for LLM interactions."""
|