loopflow 0.1.2__tar.gz → 0.2.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.2.0/.gitignore +1 -0
- loopflow-0.2.0/PKG-INFO +39 -0
- loopflow-0.2.0/README.md +19 -0
- loopflow-0.2.0/pyproject.toml +36 -0
- loopflow-0.2.0/src/loopflow/__init__.py +3 -0
- loopflow-0.2.0/src/loopflow/cli.py +49 -0
- loopflow-0.2.0/src/loopflow/context.py +91 -0
- loopflow-0.2.0/src/loopflow/launcher.py +35 -0
- loopflow-0.1.2/LICENSE +0 -21
- loopflow-0.1.2/PKG-INFO +0 -151
- loopflow-0.1.2/README.md +0 -133
- loopflow-0.1.2/pyproject.toml +0 -44
- loopflow-0.1.2/setup.cfg +0 -4
- loopflow-0.1.2/src/lf/__init__.py +0 -0
- loopflow-0.1.2/src/lf/cli.py +0 -36
- loopflow-0.1.2/src/lf/cp/__init__.py +0 -0
- loopflow-0.1.2/src/lf/cp/cli.py +0 -385
- loopflow-0.1.2/src/lf/cp/file.py +0 -693
- loopflow-0.1.2/src/lf/cp/token_profiler.py +0 -588
- loopflow-0.1.2/src/lf/git.py +0 -98
- loopflow-0.1.2/src/loopflow.egg-info/PKG-INFO +0 -151
- loopflow-0.1.2/src/loopflow.egg-info/SOURCES.txt +0 -16
- loopflow-0.1.2/src/loopflow.egg-info/dependency_links.txt +0 -1
- loopflow-0.1.2/src/loopflow.egg-info/entry_points.txt +0 -3
- loopflow-0.1.2/src/loopflow.egg-info/requires.txt +0 -5
- loopflow-0.1.2/src/loopflow.egg-info/top_level.txt +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.pypirc
|
loopflow-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: loopflow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Arrange LLMs to code in harmony
|
|
5
|
+
Author: Jack
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ai,claude,cli,coding,llm
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Software Development
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: typer>=0.9.0
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# Loopflow
|
|
22
|
+
|
|
23
|
+
Arrange LLMs to code in harmony.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
`pip install loopflow`
|
|
28
|
+
|
|
29
|
+
## Basic Usage
|
|
30
|
+
|
|
31
|
+
`lf claude review`: Launches a claude code session with a default initial prompt. Should Include:
|
|
32
|
+
* README and STYLE info from the entire codebase
|
|
33
|
+
* A default "perspective" file, i.e. something like `.lf/perspectives/default.lf`
|
|
34
|
+
* The contents of the task, e.g. something like `.lf/tasks/review.lf`
|
|
35
|
+
|
|
36
|
+
`lf claude review -p`: Uses claude's print mode, which is to say:
|
|
37
|
+
* Also wraps the claude code in our commit wrapper to make it easier to make atomic in git
|
|
38
|
+
|
|
39
|
+
`lf claude review -p artist`: Uses `.lf/perspectives/artist.lf` or something
|
loopflow-0.2.0/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Loopflow
|
|
2
|
+
|
|
3
|
+
Arrange LLMs to code in harmony.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
`pip install loopflow`
|
|
8
|
+
|
|
9
|
+
## Basic Usage
|
|
10
|
+
|
|
11
|
+
`lf claude review`: Launches a claude code session with a default initial prompt. Should Include:
|
|
12
|
+
* README and STYLE info from the entire codebase
|
|
13
|
+
* A default "perspective" file, i.e. something like `.lf/perspectives/default.lf`
|
|
14
|
+
* The contents of the task, e.g. something like `.lf/tasks/review.lf`
|
|
15
|
+
|
|
16
|
+
`lf claude review -p`: Uses claude's print mode, which is to say:
|
|
17
|
+
* Also wraps the claude code in our commit wrapper to make it easier to make atomic in git
|
|
18
|
+
|
|
19
|
+
`lf claude review -p artist`: Uses `.lf/perspectives/artist.lf` or something
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "loopflow"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Arrange LLMs to code in harmony"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [{ name = "Jack" }]
|
|
9
|
+
keywords = ["llm", "claude", "ai", "coding", "cli"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Environment :: Console",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Topic :: Software Development",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"typer>=0.9.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
lf = "loopflow.cli:app"
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["hatchling"]
|
|
30
|
+
build-backend = "hatchling.build"
|
|
31
|
+
|
|
32
|
+
[tool.hatch.build.targets.wheel]
|
|
33
|
+
packages = ["src/loopflow"]
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.sdist]
|
|
36
|
+
include = ["src/loopflow"]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Loopflow CLI: Arrange LLMs to code in harmony."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from loopflow.context import build_prompt, find_repo_root
|
|
6
|
+
from loopflow.launcher import check_claude_available, launch_claude
|
|
7
|
+
|
|
8
|
+
app = typer.Typer(
|
|
9
|
+
name="lf",
|
|
10
|
+
help="Arrange LLMs to code in harmony.",
|
|
11
|
+
no_args_is_help=True,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@app.command()
|
|
16
|
+
def claude(
|
|
17
|
+
task: str = typer.Argument(help="Task name (e.g., 'review')"),
|
|
18
|
+
print_mode: bool = typer.Option(
|
|
19
|
+
False, "-p", "-P", "--print", help="Use Claude's print mode"
|
|
20
|
+
),
|
|
21
|
+
role: str = typer.Option(
|
|
22
|
+
"default", "-r", "--role", help="Role file to use"
|
|
23
|
+
),
|
|
24
|
+
):
|
|
25
|
+
"""Launch a Claude Code session with context."""
|
|
26
|
+
repo_root = find_repo_root()
|
|
27
|
+
if not repo_root:
|
|
28
|
+
typer.echo("Error: Not in a git repository", err=True)
|
|
29
|
+
raise typer.Exit(1)
|
|
30
|
+
|
|
31
|
+
if not check_claude_available():
|
|
32
|
+
typer.echo("Error: 'claude' CLI not found. Install Claude Code first.", err=True)
|
|
33
|
+
raise typer.Exit(1)
|
|
34
|
+
|
|
35
|
+
prompt = build_prompt(repo_root, task, role)
|
|
36
|
+
exit_code = launch_claude(prompt, print_mode=print_mode, cwd=repo_root)
|
|
37
|
+
raise typer.Exit(exit_code)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.command()
|
|
41
|
+
def version():
|
|
42
|
+
"""Show loopflow version."""
|
|
43
|
+
from loopflow import __version__
|
|
44
|
+
|
|
45
|
+
typer.echo(f"loopflow {__version__}")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
app()
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Context gathering for LLM sessions."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def find_repo_root(start: Path | None = None) -> Path | None:
|
|
7
|
+
"""Find the git repository root from the given path."""
|
|
8
|
+
path = start or Path.cwd()
|
|
9
|
+
path = path.resolve()
|
|
10
|
+
|
|
11
|
+
while path != path.parent:
|
|
12
|
+
if (path / ".git").exists():
|
|
13
|
+
return path
|
|
14
|
+
path = path.parent
|
|
15
|
+
|
|
16
|
+
if (path / ".git").exists():
|
|
17
|
+
return path
|
|
18
|
+
return None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _read_file_if_exists(path: Path) -> str | None:
|
|
22
|
+
if path.exists() and path.is_file():
|
|
23
|
+
return path.read_text()
|
|
24
|
+
return None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def gather_readme(repo_root: Path) -> str | None:
|
|
28
|
+
"""Gather README content from the repository."""
|
|
29
|
+
for name in ["README.md", "README.txt", "README"]:
|
|
30
|
+
content = _read_file_if_exists(repo_root / name)
|
|
31
|
+
if content:
|
|
32
|
+
return content
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def gather_style(repo_root: Path) -> str | None:
|
|
37
|
+
"""Gather STYLE guide content from the repository."""
|
|
38
|
+
for name in ["STYLE.md", "STYLE.txt", "STYLE"]:
|
|
39
|
+
content = _read_file_if_exists(repo_root / name)
|
|
40
|
+
if content:
|
|
41
|
+
return content
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def gather_role(repo_root: Path, name: str = "default") -> str | None:
|
|
46
|
+
"""Gather role file content."""
|
|
47
|
+
lf_dir = repo_root / ".lf" / "roles"
|
|
48
|
+
for ext in [".lf", ".md", ".txt", ""]:
|
|
49
|
+
content = _read_file_if_exists(lf_dir / f"{name}{ext}")
|
|
50
|
+
if content:
|
|
51
|
+
return content
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def gather_task(repo_root: Path, name: str) -> str | None:
|
|
56
|
+
"""Gather task file content."""
|
|
57
|
+
lf_dir = repo_root / ".lf" / "tasks"
|
|
58
|
+
for ext in [".lf", ".md", ".txt", ""]:
|
|
59
|
+
content = _read_file_if_exists(lf_dir / f"{name}{ext}")
|
|
60
|
+
if content:
|
|
61
|
+
return content
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def build_prompt(
|
|
66
|
+
repo_root: Path,
|
|
67
|
+
task: str,
|
|
68
|
+
role: str = "default",
|
|
69
|
+
) -> str:
|
|
70
|
+
"""Build the full prompt for an LLM session."""
|
|
71
|
+
parts = []
|
|
72
|
+
|
|
73
|
+
readme = gather_readme(repo_root)
|
|
74
|
+
if readme:
|
|
75
|
+
parts.append(f"# Project README\n\n{readme}")
|
|
76
|
+
|
|
77
|
+
style = gather_style(repo_root)
|
|
78
|
+
if style:
|
|
79
|
+
parts.append(f"# Style Guide\n\n{style}")
|
|
80
|
+
|
|
81
|
+
role_content = gather_role(repo_root, role)
|
|
82
|
+
if role_content:
|
|
83
|
+
parts.append(f"# Role: {role}\n\n{role_content}")
|
|
84
|
+
|
|
85
|
+
task_content = gather_task(repo_root, task)
|
|
86
|
+
if task_content:
|
|
87
|
+
parts.append(f"# Task: {task}\n\n{task_content}")
|
|
88
|
+
else:
|
|
89
|
+
parts.append(f"# Task: {task}\n\nNo task file found for '{task}'.")
|
|
90
|
+
|
|
91
|
+
return "\n\n---\n\n".join(parts)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Launch LLM coding sessions."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def launch_claude(
|
|
9
|
+
prompt: str,
|
|
10
|
+
print_mode: bool = False,
|
|
11
|
+
cwd: Path | None = None,
|
|
12
|
+
) -> int:
|
|
13
|
+
"""Launch a Claude Code session with the given prompt."""
|
|
14
|
+
cmd = ["claude"]
|
|
15
|
+
|
|
16
|
+
if print_mode:
|
|
17
|
+
cmd.append("--print")
|
|
18
|
+
|
|
19
|
+
cmd.extend(["--prompt", prompt])
|
|
20
|
+
|
|
21
|
+
result = subprocess.run(cmd, cwd=cwd)
|
|
22
|
+
return result.returncode
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def check_claude_available() -> bool:
|
|
26
|
+
"""Check if the claude CLI is available."""
|
|
27
|
+
try:
|
|
28
|
+
subprocess.run(
|
|
29
|
+
["claude", "--version"],
|
|
30
|
+
capture_output=True,
|
|
31
|
+
check=True,
|
|
32
|
+
)
|
|
33
|
+
return True
|
|
34
|
+
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
35
|
+
return False
|
loopflow-0.1.2/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.2/PKG-INFO
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: loopflow
|
|
3
|
-
Version: 0.1.2
|
|
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.10
|
|
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
|
-
loopflow: arrange llms to code in harmony
|
|
20
|
-
|
|
21
|
-
## Installation
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pip install loopflow
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Or install from source:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
git clone https://github.com/loopflowstudio/loopflow.git
|
|
31
|
-
cd loopflow
|
|
32
|
-
uv venv
|
|
33
|
-
uv pip install -e .
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## lfcp
|
|
37
|
-
|
|
38
|
-
lfcp gathers files into context for LLM queries, building on e.g. `files-to-prompt`.
|
|
39
|
-
|
|
40
|
-
### Features
|
|
41
|
-
|
|
42
|
-
- **Smart Context Gathering**: Automatically includes parent README files up to git root
|
|
43
|
-
- **Gitignore Integration**: Respects `.gitignore` and `.cpignore` patterns
|
|
44
|
-
- **Extension Filtering**: Focus on specific file types with `-e` flags
|
|
45
|
-
- **Token Profiling**: Analyze token usage with detailed breakdowns and interactive flamegraphs
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
### Basic Usage
|
|
50
|
-
|
|
51
|
-
Copy the current directory to clipboard:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
lfcp .
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Common Workflows
|
|
58
|
-
|
|
59
|
-
Copy specific directories:
|
|
60
|
-
```bash
|
|
61
|
-
lfcp src/ tests/
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Copy only Python files:
|
|
65
|
-
```bash
|
|
66
|
-
lfcp . -e py
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Copy multiple file types:
|
|
70
|
-
```bash
|
|
71
|
-
lfcp . -e py -e js -e tsx
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Output to stdout instead of clipboard:
|
|
75
|
-
```bash
|
|
76
|
-
lfcp . -s
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Copy only README files (great for project overview):
|
|
80
|
-
```bash
|
|
81
|
-
lfcp . -r
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Ignore specific directories:
|
|
85
|
-
```bash
|
|
86
|
-
lfcp . -i build -i dist
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Token Profiling
|
|
90
|
-
|
|
91
|
-
Analyze token usage across your codebase:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
lfcp . --profile
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Generate an interactive flamegraph visualization:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
lfcp . --flamegraph
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
The flamegraph will be saved as `token_flamegraph.html` and can be opened in any browser.
|
|
104
|
-
|
|
105
|
-
### Advanced Options
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
Options:
|
|
109
|
-
-e, --extensions TEXT Filter by file extension (e.g., -e py -e js)
|
|
110
|
-
-r, --readmes Only include README files
|
|
111
|
-
-s, --stdout Output to stdout instead of clipboard
|
|
112
|
-
-i, --ignore TEXT Additional ignore patterns (can be used multiple times)
|
|
113
|
-
--profile Show detailed token usage statistics
|
|
114
|
-
--flamegraph Generate interactive HTML flamegraph visualization
|
|
115
|
-
--help Show help message
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## How It Works
|
|
119
|
-
|
|
120
|
-
1. **Discovery**: Walks through specified directories, respecting gitignore rules
|
|
121
|
-
2. **Context Addition**: Automatically includes parent README files for better context
|
|
122
|
-
3. **Filtering**: Applies extension filters and ignore patterns
|
|
123
|
-
4. **Formatting**: Structures files in XML format with clear source attribution
|
|
124
|
-
5. **Output**: Copies to clipboard or outputs to stdout based on your preference
|
|
125
|
-
|
|
126
|
-
## File Format
|
|
127
|
-
|
|
128
|
-
```xml
|
|
129
|
-
<documents>
|
|
130
|
-
<document index="1">
|
|
131
|
-
<source>path/to/file.py</source>
|
|
132
|
-
<document_content>
|
|
133
|
-
# Your file content here
|
|
134
|
-
</document_content>
|
|
135
|
-
</document>
|
|
136
|
-
</documents>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Gitignore Support
|
|
140
|
-
|
|
141
|
-
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:
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
# Example .cpignore
|
|
145
|
-
*.pyc
|
|
146
|
-
__pycache__/
|
|
147
|
-
node_modules/
|
|
148
|
-
*.egg-info
|
|
149
|
-
build/
|
|
150
|
-
dist/
|
|
151
|
-
```
|
loopflow-0.1.2/README.md
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
loopflow: arrange llms to code in harmony
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
pip install loopflow
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
Or install from source:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
git clone https://github.com/loopflowstudio/loopflow.git
|
|
13
|
-
cd loopflow
|
|
14
|
-
uv venv
|
|
15
|
-
uv pip install -e .
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## lfcp
|
|
19
|
-
|
|
20
|
-
lfcp gathers files into context for LLM queries, building on e.g. `files-to-prompt`.
|
|
21
|
-
|
|
22
|
-
### Features
|
|
23
|
-
|
|
24
|
-
- **Smart Context Gathering**: Automatically includes parent README files up to git root
|
|
25
|
-
- **Gitignore Integration**: Respects `.gitignore` and `.cpignore` patterns
|
|
26
|
-
- **Extension Filtering**: Focus on specific file types with `-e` flags
|
|
27
|
-
- **Token Profiling**: Analyze token usage with detailed breakdowns and interactive flamegraphs
|
|
28
|
-
|
|
29
|
-
## Usage
|
|
30
|
-
|
|
31
|
-
### Basic Usage
|
|
32
|
-
|
|
33
|
-
Copy the current directory to clipboard:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
lfcp .
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Common Workflows
|
|
40
|
-
|
|
41
|
-
Copy specific directories:
|
|
42
|
-
```bash
|
|
43
|
-
lfcp src/ tests/
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Copy only Python files:
|
|
47
|
-
```bash
|
|
48
|
-
lfcp . -e py
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Copy multiple file types:
|
|
52
|
-
```bash
|
|
53
|
-
lfcp . -e py -e js -e tsx
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Output to stdout instead of clipboard:
|
|
57
|
-
```bash
|
|
58
|
-
lfcp . -s
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Copy only README files (great for project overview):
|
|
62
|
-
```bash
|
|
63
|
-
lfcp . -r
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Ignore specific directories:
|
|
67
|
-
```bash
|
|
68
|
-
lfcp . -i build -i dist
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Token Profiling
|
|
72
|
-
|
|
73
|
-
Analyze token usage across your codebase:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
lfcp . --profile
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Generate an interactive flamegraph visualization:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
lfcp . --flamegraph
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
The flamegraph will be saved as `token_flamegraph.html` and can be opened in any browser.
|
|
86
|
-
|
|
87
|
-
### Advanced Options
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
Options:
|
|
91
|
-
-e, --extensions TEXT Filter by file extension (e.g., -e py -e js)
|
|
92
|
-
-r, --readmes Only include README files
|
|
93
|
-
-s, --stdout Output to stdout instead of clipboard
|
|
94
|
-
-i, --ignore TEXT Additional ignore patterns (can be used multiple times)
|
|
95
|
-
--profile Show detailed token usage statistics
|
|
96
|
-
--flamegraph Generate interactive HTML flamegraph visualization
|
|
97
|
-
--help Show help message
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## How It Works
|
|
101
|
-
|
|
102
|
-
1. **Discovery**: Walks through specified directories, respecting gitignore rules
|
|
103
|
-
2. **Context Addition**: Automatically includes parent README files for better context
|
|
104
|
-
3. **Filtering**: Applies extension filters and ignore patterns
|
|
105
|
-
4. **Formatting**: Structures files in XML format with clear source attribution
|
|
106
|
-
5. **Output**: Copies to clipboard or outputs to stdout based on your preference
|
|
107
|
-
|
|
108
|
-
## File Format
|
|
109
|
-
|
|
110
|
-
```xml
|
|
111
|
-
<documents>
|
|
112
|
-
<document index="1">
|
|
113
|
-
<source>path/to/file.py</source>
|
|
114
|
-
<document_content>
|
|
115
|
-
# Your file content here
|
|
116
|
-
</document_content>
|
|
117
|
-
</document>
|
|
118
|
-
</documents>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Gitignore Support
|
|
122
|
-
|
|
123
|
-
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:
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
# Example .cpignore
|
|
127
|
-
*.pyc
|
|
128
|
-
__pycache__/
|
|
129
|
-
node_modules/
|
|
130
|
-
*.egg-info
|
|
131
|
-
build/
|
|
132
|
-
dist/
|
|
133
|
-
```
|
loopflow-0.1.2/pyproject.toml
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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.2"
|
|
8
|
-
description = "arrange llms to code in harmony"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.10"
|
|
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.2/setup.cfg
DELETED
|
File without changes
|
loopflow-0.1.2/src/lf/cli.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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()
|
|
File without changes
|