refactor-cli 0.1.0__tar.gz → 0.1.2__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.
- refactor_cli-0.1.2/.github/workflows/publish.yml +34 -0
- refactor_cli-0.1.2/.gitignore +207 -0
- refactor_cli-0.1.2/.refactorignore +1 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/PKG-INFO +1 -1
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/pyproject.toml +8 -2
- refactor_cli-0.1.2/refactor/cli.py +56 -0
- refactor_cli-0.1.2/refactor/ignore.py +24 -0
- refactor_cli-0.1.2/refactor/metadata.py +12 -0
- refactor_cli-0.1.2/refactor/scanner.py +17 -0
- refactor_cli-0.1.2/refactor/validation.py +18 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor_cli.egg-info/PKG-INFO +1 -1
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor_cli.egg-info/SOURCES.txt +7 -0
- refactor_cli-0.1.0/refactor/cli.py +0 -18
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/LICENSE +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/README.md +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor/__init__.py +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor/tree.py +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor_cli.egg-info/dependency_links.txt +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor_cli.egg-info/entry_points.txt +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor_cli.egg-info/requires.txt +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/refactor_cli.egg-info/top_level.txt +0 -0
- {refactor_cli-0.1.0 → refactor_cli-0.1.2}/setup.cfg +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment: pypi
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout code
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v6
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.x"
|
|
24
|
+
|
|
25
|
+
- name: Install build tools
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install build
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: python -m build
|
|
32
|
+
|
|
33
|
+
- name: Publish to PyPI
|
|
34
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.txt
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "refactor-cli" # must be unique on PyPI
|
|
3
|
-
|
|
3
|
+
dynamic = ["version"]
|
|
4
4
|
description = "CLI tool to organize files using AI"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.8"
|
|
7
7
|
dependencies = ["typer"]
|
|
8
8
|
|
|
9
9
|
[project.scripts]
|
|
10
|
-
refactor = "refactor.cli:app"
|
|
10
|
+
refactor = "refactor.cli:app"
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["setuptools>=61.0", "setuptools-scm"]
|
|
14
|
+
build-backend = "setuptools.build_meta"
|
|
15
|
+
|
|
16
|
+
[tool.setuptools_scm]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from refactor.tree import print_tree
|
|
3
|
+
from importlib.metadata import version as get_version
|
|
4
|
+
from refactor.validation import validate_path
|
|
5
|
+
from refactor.scanner import scan_directory
|
|
6
|
+
from refactor.metadata import get_metadata
|
|
7
|
+
from refactor.ignore import load_ignore_patterns
|
|
8
|
+
|
|
9
|
+
app = typer.Typer(no_args_is_help=True)
|
|
10
|
+
|
|
11
|
+
@app.command()
|
|
12
|
+
def version():
|
|
13
|
+
"""Print version information"""
|
|
14
|
+
print(get_version("refactor-cli"))
|
|
15
|
+
|
|
16
|
+
# @app.command()
|
|
17
|
+
# def tree(path: str = "."):
|
|
18
|
+
# """Print folder structure"""
|
|
19
|
+
# print_tree(path)
|
|
20
|
+
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
app()
|
|
23
|
+
|
|
24
|
+
# validates folder
|
|
25
|
+
@app.command()
|
|
26
|
+
def tree(path: str = "."):
|
|
27
|
+
"""Display folder structure of given path"""
|
|
28
|
+
try:
|
|
29
|
+
validate_path(path)
|
|
30
|
+
print_tree(path)
|
|
31
|
+
|
|
32
|
+
except ValueError as e:
|
|
33
|
+
typer.echo(f"Error: {e}")
|
|
34
|
+
raise typer.Exit(code=1)
|
|
35
|
+
|
|
36
|
+
# scanner
|
|
37
|
+
# files = scan_directory(".")
|
|
38
|
+
# print(len(files))
|
|
39
|
+
|
|
40
|
+
@app.command()
|
|
41
|
+
def scan(path: str = "."):
|
|
42
|
+
"""Scan directory and display metadata"""
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
validate_path(path)
|
|
46
|
+
|
|
47
|
+
patterns = load_ignore_patterns()
|
|
48
|
+
|
|
49
|
+
items = scan_directory(path, patterns)
|
|
50
|
+
|
|
51
|
+
for item in items:
|
|
52
|
+
print(get_metadata(item))
|
|
53
|
+
|
|
54
|
+
except ValueError as e:
|
|
55
|
+
typer.echo(f"Error: {e}")
|
|
56
|
+
raise typer.Exit(code=1)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from fnmatch import fnmatch
|
|
3
|
+
|
|
4
|
+
def load_ignore_patterns():
|
|
5
|
+
ignore_file = Path(".refactorignore")
|
|
6
|
+
|
|
7
|
+
if not ignore_file.exists():
|
|
8
|
+
print("Ignore file not found")
|
|
9
|
+
return []
|
|
10
|
+
|
|
11
|
+
with open(ignore_file) as f:
|
|
12
|
+
return [
|
|
13
|
+
line.strip()
|
|
14
|
+
for line in f
|
|
15
|
+
if line.strip() and not line.startswith("#")
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
def should_ignore(path: str, patterns: list[str]):
|
|
19
|
+
|
|
20
|
+
for pattern in patterns:
|
|
21
|
+
if fnmatch(path, pattern):
|
|
22
|
+
return True
|
|
23
|
+
|
|
24
|
+
return False
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from refactor.ignore import should_ignore
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def scan_directory(path: str, ignore_patterns: list[str]):
|
|
7
|
+
|
|
8
|
+
files = []
|
|
9
|
+
|
|
10
|
+
for item in Path(path).rglob("*"):
|
|
11
|
+
|
|
12
|
+
if should_ignore(item.name, ignore_patterns):
|
|
13
|
+
continue
|
|
14
|
+
|
|
15
|
+
files.append(item)
|
|
16
|
+
|
|
17
|
+
return files
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def validate_path(path: str):
|
|
6
|
+
|
|
7
|
+
target = Path(path)
|
|
8
|
+
|
|
9
|
+
if not target.exists():
|
|
10
|
+
raise ValueError(f"Path does not exist: {path}")
|
|
11
|
+
|
|
12
|
+
if not target.is_dir():
|
|
13
|
+
raise ValueError(f"Not a directory: {path}")
|
|
14
|
+
|
|
15
|
+
if not os.access(target, os.R_OK):
|
|
16
|
+
raise ValueError(f"No read permission: {path}")
|
|
17
|
+
|
|
18
|
+
return target
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
.refactorignore
|
|
1
3
|
LICENSE
|
|
2
4
|
README.md
|
|
3
5
|
pyproject.toml
|
|
6
|
+
.github/workflows/publish.yml
|
|
4
7
|
refactor/__init__.py
|
|
5
8
|
refactor/cli.py
|
|
9
|
+
refactor/ignore.py
|
|
10
|
+
refactor/metadata.py
|
|
11
|
+
refactor/scanner.py
|
|
6
12
|
refactor/tree.py
|
|
13
|
+
refactor/validation.py
|
|
7
14
|
refactor_cli.egg-info/PKG-INFO
|
|
8
15
|
refactor_cli.egg-info/SOURCES.txt
|
|
9
16
|
refactor_cli.egg-info/dependency_links.txt
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import typer
|
|
2
|
-
from refactor.tree import print_tree
|
|
3
|
-
from importlib.metadata import version as get_version
|
|
4
|
-
|
|
5
|
-
app = typer.Typer(no_args_is_help=True)
|
|
6
|
-
|
|
7
|
-
@app.command()
|
|
8
|
-
def version():
|
|
9
|
-
"""Print Version Information"""
|
|
10
|
-
print(get_version("refactor-cli"))
|
|
11
|
-
|
|
12
|
-
@app.command()
|
|
13
|
-
def tree(path: str = "."):
|
|
14
|
-
"""Print folder structure"""
|
|
15
|
-
print_tree(path)
|
|
16
|
-
|
|
17
|
-
if __name__ == "__main__":
|
|
18
|
-
app()
|
|
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
|