Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
832c0bc
Move pypi flattent to pypi
ayjayt Apr 23, 2025
0d73ef4
Add pypi into audit-versions
ayjayt Apr 23, 2025
154b78d
Append pypi version with v
ayjayt Apr 23, 2025
9ba76a1
Move tests out of package directory
ayjayt Apr 24, 2025
ae6187e
Merge remote-tracking branch 'origin/main' into andrew/more_versions
ayjayt Apr 24, 2025
26e7deb
Merge remote-tracking branch 'origin/main' into andrew/more_versions
ayjayt Apr 24, 2025
e7ae2d8
Fix versions to use audit
ayjayt Apr 25, 2025
0091dba
Improve version-tag check
ayjayt Apr 25, 2025
9811319
Mention non-comformant python in audit
ayjayt Apr 26, 2025
6e1e872
Refactor and fix to print out basic version audit
ayjayt Apr 26, 2025
a904958
Type and format colored
ayjayt Apr 26, 2025
1bacaf8
Fix typing
ayjayt Apr 26, 2025
cde8d54
Change module name.
ayjayt Apr 26, 2025
c91c815
Rename some functions
ayjayt Apr 26, 2025
b2147b4
Refactor (and break) _versions.py
ayjayt Apr 26, 2025
de2a07f
Fix small syntax bug.
ayjayt Apr 26, 2025
f627eb0
Finish type checking.
ayjayt Apr 26, 2025
0e71f9e
Improve version class.
ayjayt Apr 26, 2025
b871ea6
Add a bad-version parser
ayjayt Apr 27, 2025
4052bc2
Make _versions.py public
ayjayt Apr 27, 2025
fa983cc
Format
ayjayt Apr 27, 2025
7a64eb4
Type and comment
ayjayt Apr 27, 2025
aea3295
Remove old call
ayjayt Apr 27, 2025
77670eb
Change to use new Version, not explode_versions
ayjayt Apr 27, 2025
5803209
Mid Major Audit Refactor: See Commit:
ayjayt Apr 28, 2025
3d96c76
Force get_projects_config to need filename
ayjayt Apr 28, 2025
ef9c0d5
Change get_pypi to take project name
ayjayt Apr 28, 2025
4605311
Detect Not Found in get_pypi
ayjayt Apr 28, 2025
cc6f2a7
Skip columns if get_pypi() returns sadness>0
ayjayt Apr 28, 2025
54f7656
Add more color silencing
ayjayt Apr 28, 2025
8840676
Make bad verisons work.
ayjayt Apr 28, 2025
de41bcb
Add color and indication to bad versions
ayjayt Apr 28, 2025
77940e4
Increase default count to 20
ayjayt Apr 28, 2025
ad9ea01
Separate package audit into new file
ayjayt Apr 28, 2025
5a1a54a
Refactor audit framework
ayjayt Apr 29, 2025
76849ac
Format and check versionweird
ayjayt Apr 29, 2025
fa6af87
Remove comments
ayjayt Apr 29, 2025
791d755
Merge remote-tracking branch 'origin/main' into andrew/more_versions
ayjayt Apr 29, 2025
6c77bb8
Fix bad var name
ayjayt Apr 29, 2025
968c67b
Bug fix and run audit
ayjayt Apr 29, 2025
ca7cf04
Add verison and count arguments.
ayjayt Apr 29, 2025
26ea2ee
Refactor a bit
ayjayt Apr 29, 2025
dc9fbbb
Change names and add debugs
ayjayt Apr 29, 2025
afedd76
Fix closure bug
ayjayt Apr 29, 2025
7cc068b
Fix 0 falsy bug
ayjayt Apr 29, 2025
bc400cf
Move version calculation to post_init
ayjayt Apr 29, 2025
836d121
Refactor printing a bit
ayjayt Apr 29, 2025
c3d7a6c
Remove loud debugs
ayjayt Apr 29, 2025
4942832
Remove notes file
ayjayt Apr 29, 2025
85236b6
Specify None to avoid 0 false positives
ayjayt Apr 29, 2025
82bb1ea
Allow async noops
ayjayt Apr 29, 2025
876018d
Add new test for audit-versions
davidangarita1 Apr 29, 2025
14ffd3e
Remove audit-releases command
davidangarita1 Apr 29, 2025
3dfadb1
Remove audit-releases from test
davidangarita1 Apr 29, 2025
a4bf54e
Remove audit-pypi command
davidangarita1 Apr 29, 2025
624bb93
Add magic method json to Version class
davidangarita1 Apr 30, 2025
415711c
Add method json to Tag class
davidangarita1 Apr 30, 2025
29545ab
Add method json to Release class
davidangarita1 Apr 30, 2025
b856fd4
Remove project-config from integration tests
davidangarita1 Apr 30, 2025
8562410
Add new command called filename
davidangarita1 Apr 30, 2025
46b86ae
Merge pull request #63 from geopozo/david/andrew/more_versions_tests
ayjayt Apr 30, 2025
c7a4cd8
Start basic audit status
ayjayt Apr 30, 2025
48041de
Format status output
ayjayt Apr 30, 2025
a75813a
Fix type errors
ayjayt Apr 30, 2025
f3ca63d
Implement json for audit
ayjayt May 2, 2025
1be1562
Fix ROADMAP.md + pre-commit-config.yml
ayjayt Nov 24, 2025
04c095d
More update to ROADMAP
ayjayt Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# See https://pre-commit.com/hooks.html for more hooks
%YAML 1.2
---
exclude: "site/.*"
default_install_hook_types: [pre-commit, commit-msg]
default_stages: [pre-commit]
exclude: 'site/.*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -18,12 +18,12 @@ repos:
- id: check-toml
- id: debug-statements
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.1.0
rev: v4.0.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.11.6
rev: v0.14.4
hooks:
# Run the linter.
- id: ruff
Expand All @@ -33,22 +33,20 @@ repos:
types_or: [python, pyi]
# options: ignore one line things [E701]
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
rev: v1.37.1
hooks:
- id: yamllint
name: yamllint
description: This hook runs yamllint.
entry: yamllint
language: python
types: [file, yaml]
args: ['-d', "{\
extends: default,\
rules: {\
colons: { max-spaces-after: -1 }\
}\
}"]
args: [
'-d',
"{ extends: default, rules: { colons: { max-spaces-after: -1 } } }",
]
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
rev: v1.7.8
hooks:
- id: actionlint
name: Lint GitHub Actions workflow files
Expand All @@ -69,18 +67,9 @@ repos:
args: [--staged, -c, "general.ignore=B6,T3", --msg-filename]
stages: [commit-msg]
- repo: https://github.com/crate-ci/typos
rev: v1.28.2
rev: v1
hooks:
- id: typos
- repo: https://github.com/markdownlint/markdownlint
rev: v0.13.0
hooks:
- id: markdownlint
name: Markdownlint
description: Run markdownlint on your Markdown files
entry: mdl --style .markdown.rb
language: ruby
files: \.(md|mdown|markdown)$
- repo: https://github.com/Yelp/detect-secrets
rev: v1.5.0
hooks:
Expand All @@ -89,3 +78,15 @@ repos:
language: python
entry: detect-secrets-hook
args: ['']
- repo: https://github.com/rvben/rumdl-pre-commit
rev: v0.0.173 # Use the latest release tag
hooks:
- id: rumdl
# To only check (default):
# args: []
# To automatically fix issues:
# args: [--fix]
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.407 # pin a tag; latest as of 2025-10-01
hooks:
- id: pyright
37 changes: 37 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Roadmap

- [ ] BLOCKING: we need to make decision about versions/diff and merge

- [ ] We need to manually close the agent. (new branch)!!!

- [ ] Diff arbol:
- [ ] No imprimir pretty, solo indicar diferencias
- [ ] Manera de "ignorar rutas"
- [ ] Descargar Plantillas

- [ ] Errores:
- [ ] `get_project_config` esconde errores?

- [ ] Refactor to V1.1
- [ ] Auditoria de version: rango de tiempo
- [ ] Reorgnaizer Internos
- service gh
- gh-name
- name
- audit name
- algo FACÍL usar
- [ ] Typer
- [ ] Imprimir:
- [ ] sitio web
- [ ] es espejo? Cómo está "upstream"
- [ ] Imprimir *un* repo o grupo, no solo -a
- [ ] Mostrar info de ramas

- [ ] Esconder archivo/privado
- [ ] Mejorar filtrar
- [ ] Imprimir enlaces/activación para funciones (discussión)
- [ ] Issues/PRs stats

- [ ] revisar locales

- [ ] Seguridad, codeowners, permisos acciones
25 changes: 15 additions & 10 deletions src/integration_test/test.sh → integration_test/test.es.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ REPO="$1"
total=0
success=0
fail=0
failed_cmds=()

print_and_run() {
echo -e "\n=============================="
Expand All @@ -19,7 +20,8 @@ print_and_run() {
((success++))
else
((fail++))
echo -e "\033[0;31m❌ Falló el commando:\033[0m"
failed_cmds+=("$*")
echo -e "\033[0;31m❌ Falló el comando:\033[0m"
echo -e "\033[0;31m$*\033[0m"
fi
}
Expand All @@ -33,10 +35,8 @@ run_basic_commands() {

local repo_cmds=(
"tags -r $REPO"
"project-configs -r $REPO"
"releases -r $REPO"
"pypi -r $REPO"
"audit-releases -r $REPO"
"audit-repo -r $REPO"
"audit-versions -r $REPO"
)
Expand All @@ -55,17 +55,17 @@ run_pretty_commands() {

local repo_cmds=(
"tags -r $REPO"
"project-configs -r $REPO"
"releases -r $REPO"
"pypi -r $REPO"
"audit-releases -r $REPO"
"audit-repo -r $REPO"
"audit-versions -r $REPO"
)

for cmd in "${repo_cmds[@]}"; do
print_and_run "$base_cmd $cmd"
done

print_and_run "$base_cmd audit-versions -r $REPO -c 3"
}

run_pretty_json_commands() {
Expand All @@ -77,10 +77,8 @@ run_pretty_json_commands() {

local repo_cmds=(
"tags -r $REPO"
"project-configs -r $REPO"
"releases -r $REPO"
"pypi -r $REPO"
"audit-releases -r $REPO"
"audit-repo -r $REPO"
"audit-versions -r $REPO"
)
Expand All @@ -96,6 +94,13 @@ run_pretty_json_commands

echo -e "\n=============================="
echo -e "Resumen de ejecución:"
printf "Total de commandos : %d\n" "$total"
printf "Commandos exitosos : \033[0;32m%d\033[0m\n" "$success"
printf "Commandos fallidos : \033[0;31m%d\033[0m\n" "$fail"
printf "Total de comandos : %d\n" "$total"
printf "Comandos exitosos : \033[0;32m%d\033[0m\n" "$success"
printf "Comandos fallidos : \033[0;31m%d\033[0m\n" "$fail"

if (( fail > 0 )); then
echo -e "\n\033[0;31m❌ Lista de comandos fallidos:\033[0m"
for cmd in "${failed_cmds[@]}"; do
echo -e "\033[0;31m$cmd\033[0m"
done
fi
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,6 @@ help = "Run test by test, slowly, quitting after first error"
[tool.poe.tasks.filter-test]
cmd = "pytest -W error -vvvx -rA"
help = "Run any/all tests one by one with basic settings: can include filename and -k filters"

[tool.typos]
files.extend-exclude = ["*.es.*"]
17 changes: 7 additions & 10 deletions src/github_helper/_adapters/api_to_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ class GHAdapter:
def _check_options(self, formatters):
formats = {k for k, v in formatters.items() if v}
invalid_formats = {"html", "url"} & formats
if (
(self._command == "auth-status" and formats)
or (self._command != "repos" and invalid_formats)
or (self._command == "audit-releases" and self._json)
if (self._command == "auth-status" and formats) or (
self._command != "repos" and invalid_formats
):
raise NotImplementedError(
f"{', '.join(invalid_formats)} not valid flags for {self._command}",
Expand Down Expand Up @@ -123,8 +121,8 @@ async def transform_releases_data(self, releases_data):
return to_table.format_table(
[
[
release["tag"],
delim.join(release["files"]),
release.tag,
delim.join(release.files),
]
for release in releases_data
],
Expand All @@ -139,11 +137,10 @@ async def transform_pypi_data(self, releases_data):
return to_table.format_table(
[
[
f"{name}-{release['tag']}",
delim.join(release["files"]),
f"{release.tag}",
delim.join(release.files),
]
for name, subobject in releases_data.items()
for release in subobject
for release in releases_data
],
pretty=self._pretty,
headers=("version", "files"),
Expand Down
6 changes: 4 additions & 2 deletions src/github_helper/_adapters/to_html/_components.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from collections.abc import Iterable

import logistro
from htmy import Component, Renderer, core, html

Expand Down Expand Up @@ -31,8 +33,8 @@ def modal(


async def render_page(
heads: core.BaseTag,
content: core.BaseTag,
heads: Iterable[core.BaseTag],
content: Iterable[core.BaseTag],
):
tailwindcss_cdn = "https://cdn.tailwindcss.com"
_logger.debug("Rendering.")
Expand Down
72 changes: 34 additions & 38 deletions src/github_helper/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ def _get_cli_args():
help="Name of repository required.",
required=True,
)
configs_parser.add_argument(
"-f",
"--filename",
help="Name of the file required.",
required=True,
)

releases_parser = subparsers.add_parser(
"releases",
Expand Down Expand Up @@ -150,36 +156,6 @@ def _get_cli_args():
help="Use testing pypi, not regular.",
)

pypi_audit_parser = subparsers.add_parser(
"audit-pypi",
description="Show all pypi packages from a repo with comments.",
help="Return all pypi releases of a repo.",
)
pypi_audit_parser.add_argument(
"-r",
"--repo",
help="Name of repository required.",
required=True,
)
pypi_audit_parser.add_argument(
"-t",
"--testing",
action="store_true",
help="Use testing pypi, not regular.",
)

releases_audit_parser = subparsers.add_parser(
"audit-releases",
description="Show all releases from a repo with comments.",
help="Return all releases of a repo with comments.",
)
releases_audit_parser.add_argument(
"-r",
"--repo",
help="Name of repository required.",
required=True,
)

audit_repo = subparsers.add_parser(
"audit-repo",
description="",
Expand All @@ -203,6 +179,25 @@ def _get_cli_args():
required=True,
)

group = audit_versions.add_mutually_exclusive_group()

group.add_argument(
"-c",
"--count",
action="store",
type=int,
default=15,
help="How many versions to audit",
)
group.add_argument(
"-v",
"--version",
action="store",
type=str,
default=None,
help="Audit a specific version in more detail",
)

basic_args = parser.parse_args()
return parser, vars(basic_args)

Expand All @@ -227,8 +222,11 @@ def run_cli():
async def _run_cli_async(): # noqa: C901, PLR0912, PLR0915 complex
parser, cli_args = _get_cli_args()
repo = cli_args.pop("repo", None)
filename = cli_args.pop("filename", None)
paginate = cli_args.pop("all", False) # Internamente en gh api es un --paginate
command = cli_args.pop("command", None)
count = cli_args.pop("count", None)
version = cli_args.pop("version", None)
cli_args.pop("log")
cli_args.pop("human")
testing = cli_args.pop("testing", False)
Expand All @@ -255,25 +253,23 @@ async def _run_cli_async(): # noqa: C901, PLR0912, PLR0915 complex
data, sadness = await gh.get_remote_tags(repo)
data = await adpt.transform_tags_data(data)
case "project-configs":
data, sadness = await gh.get_project_configs(repo)
data, sadness = await gh.get_project_configs(repo, filename)
data = await adpt.transform_project_configs_data(data)
case "releases":
data, sadness = await gh.get_releases(repo)
data = await adpt.transform_releases_data(data)
case "pypi":
data, sadness = await gh.get_pypi(repo, testing=testing)
data = await adpt.transform_pypi_data(data)
case "audit-pypi":
data, sadness = await gh.audit_pypi(repo, testing=testing)
data = await adpt.transform_audit_releases_data(data)
case "audit-releases":
data, sadness = await gh.audit_releases(repo)
data = await adpt.transform_audit_releases_data(data)
case "audit-repo":
data, sadness = await gh.audit_rulesets(repo)
data = await adpt.transform_audit_rulesets_data(data)
case "audit-versions":
data, sadness = await gh.audit_versions(repo)
data, sadness = await gh.audit_versions(
repo,
count=count,
only_version=version,
)
data = await adpt.transform_audit_versions_data(data)
case _:
print("No command supplied.", file=sys.stderr)
Expand Down
Loading