arclith-cli 0.7.1__py3-none-any.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.
- arclith_cli/__init__.py +2 -0
- arclith_cli/adapter_templates.py +173 -0
- arclith_cli/add_adapter.py +288 -0
- arclith_cli/entity_scanner.py +67 -0
- arclith_cli/export_config.py +69 -0
- arclith_cli/main.py +199 -0
- arclith_cli/rename.py +159 -0
- arclith_cli/scaffold.py +65 -0
- arclith_cli/updater.py +33 -0
- arclith_cli-0.7.1.dist-info/METADATA +192 -0
- arclith_cli-0.7.1.dist-info/RECORD +14 -0
- arclith_cli-0.7.1.dist-info/WHEEL +4 -0
- arclith_cli-0.7.1.dist-info/entry_points.txt +2 -0
- arclith_cli-0.7.1.dist-info/licenses/LICENSE +180 -0
arclith_cli/main.py
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
from rich.prompt import Prompt
|
|
11
|
+
from rich.tree import Tree
|
|
12
|
+
|
|
13
|
+
from . import __version__
|
|
14
|
+
from .add_adapter import add_adapter_cmd
|
|
15
|
+
from .export_config import export_config_cmd
|
|
16
|
+
from .rename import EntityNames, apply_rename
|
|
17
|
+
from .scaffold import download_and_extract
|
|
18
|
+
from .updater import run_update
|
|
19
|
+
|
|
20
|
+
app = typer.Typer(
|
|
21
|
+
name="arclith-cli",
|
|
22
|
+
help="Scaffold [bold]arclith[/bold] hexagonal projects from the official template.",
|
|
23
|
+
no_args_is_help=False,
|
|
24
|
+
rich_markup_mode="rich",
|
|
25
|
+
)
|
|
26
|
+
console = Console()
|
|
27
|
+
|
|
28
|
+
_ENTITY_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_\-]*$")
|
|
29
|
+
_PROJECT_RE = re.compile(r"^[A-Za-z][A-Za-z0-9_\-]*$")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@app.command()
|
|
33
|
+
def new(
|
|
34
|
+
entity: Annotated[
|
|
35
|
+
str | None,
|
|
36
|
+
typer.Argument(
|
|
37
|
+
help="Nom de l'entité au [bold]singulier[/bold] — tout format accepté : [dim]Recipe[/dim], [dim]recipe_step[/dim], [dim]meal-plan[/dim]",
|
|
38
|
+
),
|
|
39
|
+
] = None,
|
|
40
|
+
project_name: Annotated[
|
|
41
|
+
str | None,
|
|
42
|
+
typer.Argument(help="Nom du répertoire du projet. Exemple : [dim]my-recipe-service[/dim]"),
|
|
43
|
+
] = None,
|
|
44
|
+
directory: Annotated[
|
|
45
|
+
Path,
|
|
46
|
+
typer.Option("--dir", "-d", help="Répertoire parent où le projet sera créé"),
|
|
47
|
+
] = Path("."),
|
|
48
|
+
port: Annotated[
|
|
49
|
+
int,
|
|
50
|
+
typer.Option("--port", "-p", help="Port REST (MCP = port+1)"),
|
|
51
|
+
] = 8000,
|
|
52
|
+
repo_ref: Annotated[
|
|
53
|
+
str,
|
|
54
|
+
typer.Option("--ref", help="Branche ou tag Git du template _sample"),
|
|
55
|
+
] = "main",
|
|
56
|
+
) -> None:
|
|
57
|
+
"""Créer un nouveau projet [bold]arclith[/bold] scaffoldé depuis le template officiel [dim]_sample[/dim]."""
|
|
58
|
+
entity = entity or _prompt_entity()
|
|
59
|
+
project_name = project_name or _prompt_project()
|
|
60
|
+
|
|
61
|
+
names = EntityNames.from_input(entity)
|
|
62
|
+
target_dir = directory.resolve() / project_name
|
|
63
|
+
|
|
64
|
+
if target_dir.exists():
|
|
65
|
+
console.print(f"[red]✗[/red] Le répertoire existe déjà : [bold]{target_dir}[/bold]")
|
|
66
|
+
raise typer.Exit(1)
|
|
67
|
+
|
|
68
|
+
console.print(
|
|
69
|
+
Panel.fit(
|
|
70
|
+
f"[bold blue]arclith-cli[/bold blue] [dim]v{__version__}[/dim]\n\n"
|
|
71
|
+
f" Entité [bold green]{names.pascal}[/bold green] [dim]({names.snake} / {names.upper})[/dim]\n"
|
|
72
|
+
f" Projet [bold]{project_name}[/bold]\n"
|
|
73
|
+
f" Cible [dim]{target_dir}[/dim]\n"
|
|
74
|
+
f" Ports REST [bold]{port}[/bold] · MCP [bold]{port + 1}[/bold]",
|
|
75
|
+
border_style="blue",
|
|
76
|
+
title="[bold]Nouveau projet[/bold]",
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
with console.status("[bold]Téléchargement du template depuis GitHub…[/bold]"):
|
|
81
|
+
try:
|
|
82
|
+
download_and_extract(target_dir, ref=repo_ref)
|
|
83
|
+
except Exception as exc:
|
|
84
|
+
console.print(f"[red]✗ Téléchargement échoué :[/red] {exc}")
|
|
85
|
+
raise typer.Exit(1) from exc
|
|
86
|
+
|
|
87
|
+
console.print("[green]✓[/green] Template extrait")
|
|
88
|
+
|
|
89
|
+
with console.status("[bold]Renommage de l'entité…[/bold]"):
|
|
90
|
+
apply_rename(target_dir, names, project_name=project_name, port=port)
|
|
91
|
+
|
|
92
|
+
console.print("[green]✓[/green] Renommage terminé")
|
|
93
|
+
_print_summary(target_dir, project_name, port)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@app.command()
|
|
97
|
+
def update(
|
|
98
|
+
ref: Annotated[
|
|
99
|
+
str | None,
|
|
100
|
+
typer.Option("--ref", help="Branche ou tag Git cible (défaut : main)"),
|
|
101
|
+
] = None,
|
|
102
|
+
) -> None:
|
|
103
|
+
"""Mettre à jour arclith-cli vers la dernière version depuis GitHub."""
|
|
104
|
+
run_update(ref=ref)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@app.command()
|
|
108
|
+
def version() -> None:
|
|
109
|
+
"""Show the arclith-cli version."""
|
|
110
|
+
console.print(f"arclith-cli [bold]{__version__}[/bold]")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@app.command(name="add-adapter")
|
|
114
|
+
def add_adapter() -> None:
|
|
115
|
+
"""Wizard interactif pour scaffolder un nouvel [bold]adapter output[/bold] dans le projet courant."""
|
|
116
|
+
add_adapter_cmd()
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
@app.command(name="export-config")
|
|
120
|
+
def export_config(
|
|
121
|
+
output: Annotated[
|
|
122
|
+
Path,
|
|
123
|
+
typer.Option("--output", "-o", help="Chemin du fichier YAML généré"),
|
|
124
|
+
] = Path("config.yaml"),
|
|
125
|
+
) -> None:
|
|
126
|
+
"""Générer un [bold]config.yaml[/bold] unifié depuis [bold]config/[/bold] pour déploiement K8s."""
|
|
127
|
+
export_config_cmd(output=output)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
# ── Prompts interactifs ───────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
def _prompt_entity() -> str:
|
|
133
|
+
console.print(
|
|
134
|
+
"\n[bold]Entité[/bold] — utilisez le [yellow]singulier[/yellow] "
|
|
135
|
+
"[dim](ex : Recipe, recipe_step, MealPlan)[/dim]"
|
|
136
|
+
)
|
|
137
|
+
while True:
|
|
138
|
+
value = Prompt.ask(" [bold green]Nom de l'entité[/bold green]").strip()
|
|
139
|
+
if not value:
|
|
140
|
+
console.print(" [red]Le nom ne peut pas être vide.[/red]")
|
|
141
|
+
elif not _ENTITY_RE.match(value):
|
|
142
|
+
console.print(
|
|
143
|
+
" [red]Caractères invalides.[/red] "
|
|
144
|
+
"[dim]Lettres, chiffres, _ et - uniquement. Doit commencer par une lettre.[/dim]"
|
|
145
|
+
)
|
|
146
|
+
else:
|
|
147
|
+
return value
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _prompt_project() -> str:
|
|
151
|
+
console.print("\n[bold]Projet[/bold] [dim](ex : my-recipe-service, meal-planner)[/dim]")
|
|
152
|
+
while True:
|
|
153
|
+
value = Prompt.ask(" [bold green]Nom du projet[/bold green]").strip()
|
|
154
|
+
if not value:
|
|
155
|
+
console.print(" [red]Le nom ne peut pas être vide.[/red]")
|
|
156
|
+
elif not _PROJECT_RE.match(value):
|
|
157
|
+
console.print(
|
|
158
|
+
" [red]Caractères invalides.[/red] "
|
|
159
|
+
"[dim]Lettres, chiffres, _ et - uniquement. Doit commencer par une lettre.[/dim]"
|
|
160
|
+
)
|
|
161
|
+
else:
|
|
162
|
+
return value
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ── Helpers ───────────────────────────────────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
def _print_summary(target_dir: Path, project_name: str, port: int) -> None:
|
|
168
|
+
tree = Tree(f"[bold green]{project_name}/[/bold green]")
|
|
169
|
+
_build_tree(tree, target_dir, depth=0, max_depth=3)
|
|
170
|
+
console.print()
|
|
171
|
+
console.print(tree)
|
|
172
|
+
console.print(
|
|
173
|
+
Panel(
|
|
174
|
+
f"[bold cyan]cd[/bold cyan] {target_dir}\n"
|
|
175
|
+
f"[bold cyan]uv sync[/bold cyan]\n\n"
|
|
176
|
+
f"[bold cyan]uv run python main.py[/bold cyan]"
|
|
177
|
+
f" [dim]# MODE=api → REST :{port}[/dim]\n"
|
|
178
|
+
f"[bold cyan]MODE=mcp_http uv run python main.py[/bold cyan]"
|
|
179
|
+
f" [dim]# MCP :{port + 1}[/dim]",
|
|
180
|
+
title="[bold blue]Next steps[/bold blue]",
|
|
181
|
+
border_style="green",
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _build_tree(node: Tree, path: Path, depth: int, max_depth: int) -> None:
|
|
187
|
+
if depth >= max_depth:
|
|
188
|
+
return
|
|
189
|
+
try:
|
|
190
|
+
children = sorted(path.iterdir(), key=lambda p: (p.is_file(), p.name))
|
|
191
|
+
except PermissionError:
|
|
192
|
+
return
|
|
193
|
+
for child in children:
|
|
194
|
+
if child.name.startswith("."):
|
|
195
|
+
continue
|
|
196
|
+
label = f"[blue]{child.name}/[/blue]" if child.is_dir() else child.name
|
|
197
|
+
branch = node.add(label)
|
|
198
|
+
if child.is_dir():
|
|
199
|
+
_build_tree(branch, child, depth + 1, max_depth)
|
arclith_cli/rename.py
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
_SOURCE_PASCAL = "Ingredient"
|
|
8
|
+
_SOURCE_SNAKE = "ingredient"
|
|
9
|
+
_SOURCE_UPPER = "INGREDIENT"
|
|
10
|
+
|
|
11
|
+
_TEXT_EXTENSIONS = {
|
|
12
|
+
".py", ".yaml", ".yml", ".toml", ".md", ".txt", ".json",
|
|
13
|
+
".cfg", ".ini", ".env", ".sh", ".rst",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True)
|
|
18
|
+
class EntityNames:
|
|
19
|
+
pascal: str # RecipeStep
|
|
20
|
+
snake: str # recipe_step
|
|
21
|
+
upper: str # RECIPE_STEP
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_input(cls, raw: str) -> "EntityNames":
|
|
25
|
+
pascal = _to_pascal(raw)
|
|
26
|
+
snake = _to_snake(raw)
|
|
27
|
+
return cls(pascal=pascal, snake=snake, upper=snake.upper())
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def apply_rename(target_dir: Path, names: EntityNames, *, project_name: str, port: int) -> None:
|
|
31
|
+
_rename_file_contents(target_dir, names)
|
|
32
|
+
_rename_paths(target_dir, names)
|
|
33
|
+
_patch_pyproject(target_dir, project_name)
|
|
34
|
+
_patch_config(target_dir, project_name, port)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# ── Content replacement ───────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
def _replace_in_text(text: str, names: EntityNames) -> str:
|
|
40
|
+
# Order: most specific first to avoid partial overlap (UPPER before lower)
|
|
41
|
+
return (
|
|
42
|
+
text
|
|
43
|
+
.replace(_SOURCE_UPPER, names.upper)
|
|
44
|
+
.replace(_SOURCE_PASCAL, names.pascal)
|
|
45
|
+
.replace(_SOURCE_SNAKE, names.snake)
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _rename_file_contents(directory: Path, names: EntityNames) -> None:
|
|
50
|
+
for path in directory.rglob("*"):
|
|
51
|
+
if not path.is_file():
|
|
52
|
+
continue
|
|
53
|
+
if path.suffix.lower() not in _TEXT_EXTENSIONS and path.suffix != "":
|
|
54
|
+
continue
|
|
55
|
+
try:
|
|
56
|
+
text = path.read_text(encoding="utf-8")
|
|
57
|
+
except (UnicodeDecodeError, PermissionError):
|
|
58
|
+
continue
|
|
59
|
+
new_text = _replace_in_text(text, names)
|
|
60
|
+
if new_text != text:
|
|
61
|
+
path.write_text(new_text, encoding="utf-8")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# ── Path renaming ─────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
def _rename_paths(directory: Path, names: EntityNames) -> None:
|
|
67
|
+
# Deepest first so parent renames don't invalidate children
|
|
68
|
+
candidates = sorted(
|
|
69
|
+
directory.rglob("*"),
|
|
70
|
+
key=lambda p: len(p.parts),
|
|
71
|
+
reverse=True,
|
|
72
|
+
)
|
|
73
|
+
for path in candidates:
|
|
74
|
+
if not path.exists():
|
|
75
|
+
continue
|
|
76
|
+
if not any(tok in path.name for tok in (_SOURCE_SNAKE, _SOURCE_PASCAL, _SOURCE_UPPER)):
|
|
77
|
+
continue
|
|
78
|
+
new_name = _replace_in_text(path.name, names)
|
|
79
|
+
if new_name != path.name:
|
|
80
|
+
path.rename(path.parent / new_name)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
# ── pyproject.toml patching ───────────────────────────────────────────────────
|
|
84
|
+
|
|
85
|
+
def _patch_pyproject(target_dir: Path, project_name: str) -> None:
|
|
86
|
+
p = target_dir / "pyproject.toml"
|
|
87
|
+
if not p.exists():
|
|
88
|
+
return
|
|
89
|
+
text = p.read_text()
|
|
90
|
+
# Update project name (first occurrence)
|
|
91
|
+
text = re.sub(r'(?m)^name\s*=\s*"[^"]*"', f'name = "{project_name}"', text, count=1)
|
|
92
|
+
# Remove [tool.uv.sources] block (editable arclith path)
|
|
93
|
+
text = re.sub(
|
|
94
|
+
r"\[tool\.uv\.sources\]\n(?:[^\[]*)",
|
|
95
|
+
"",
|
|
96
|
+
text,
|
|
97
|
+
flags=re.DOTALL,
|
|
98
|
+
)
|
|
99
|
+
p.write_text(text.strip() + "\n")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# ── config/ directory patching ────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
def _patch_config(target_dir: Path, project_name: str, port: int) -> None:
|
|
105
|
+
_patch_yaml_field(target_dir / "config" / "app.yaml", "name", project_name)
|
|
106
|
+
_patch_yaml_field(
|
|
107
|
+
target_dir / "config" / "app.yaml",
|
|
108
|
+
"description",
|
|
109
|
+
f'"{project_name} — built on arclith"',
|
|
110
|
+
)
|
|
111
|
+
_patch_yaml_field(
|
|
112
|
+
target_dir / "config" / "adapters" / "output" / "mongodb.yaml",
|
|
113
|
+
"db_name",
|
|
114
|
+
project_name,
|
|
115
|
+
)
|
|
116
|
+
_patch_section_port(
|
|
117
|
+
target_dir / "config" / "adapters" / "input" / "fastapi.yaml",
|
|
118
|
+
port,
|
|
119
|
+
)
|
|
120
|
+
_patch_section_port(
|
|
121
|
+
target_dir / "config" / "adapters" / "input" / "fastmcp.yaml",
|
|
122
|
+
port + 1,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _patch_yaml_field(path: Path, key: str, value: str) -> None:
|
|
127
|
+
if not path.exists():
|
|
128
|
+
return
|
|
129
|
+
text = path.read_text()
|
|
130
|
+
text = re.sub(rf"(?m)(^{re.escape(key)}:\s*).*$", rf"\g<1>{value}", text, count=1)
|
|
131
|
+
path.write_text(text)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _patch_section_port(path: Path, new_port: int) -> None:
|
|
135
|
+
if not path.exists():
|
|
136
|
+
return
|
|
137
|
+
text = path.read_text()
|
|
138
|
+
text = re.sub(r"(?m)(^port:\s*)\d+", rf"\g<1>{new_port}", text, count=1)
|
|
139
|
+
path.write_text(text)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# ── Case converters ───────────────────────────────────────────────────────────
|
|
143
|
+
|
|
144
|
+
def _to_pascal(raw: str) -> str:
|
|
145
|
+
if "_" in raw or "-" in raw:
|
|
146
|
+
return "".join(w.capitalize() for w in re.split(r"[_\-]", raw) if w)
|
|
147
|
+
return raw[0].upper() + raw[1:] if raw else raw
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _to_snake(raw: str) -> str:
|
|
151
|
+
if "_" in raw:
|
|
152
|
+
return raw.lower()
|
|
153
|
+
if "-" in raw:
|
|
154
|
+
return raw.replace("-", "_").lower()
|
|
155
|
+
# PascalCase / camelCase → snake_case
|
|
156
|
+
s = re.sub(r"([A-Z]+)([A-Z][a-z])", r"\1_\2", raw)
|
|
157
|
+
s = re.sub(r"([a-z\d])([A-Z])", r"\1_\2", s)
|
|
158
|
+
return s.lower()
|
|
159
|
+
|
arclith_cli/scaffold.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import io
|
|
4
|
+
import shutil
|
|
5
|
+
import zipfile
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
_TEMPLATE_URL = "https://github.com/karned-rekipe/_sample/archive/refs/heads/{ref}.zip"
|
|
11
|
+
|
|
12
|
+
_DIRS_TO_REMOVE = {
|
|
13
|
+
"__pycache__", ".venv", ".mypy_cache", ".pytest_cache",
|
|
14
|
+
".ruff_cache", ".idea", ".github", ".git", ".files", ".dev", "htmlcov",
|
|
15
|
+
}
|
|
16
|
+
_FILES_TO_REMOVE = {
|
|
17
|
+
".coverage", "uv.lock", "AGENTS.md", "README.md", ".gitignore", "config.yaml",
|
|
18
|
+
}
|
|
19
|
+
_DATA_FILES_TO_REMOVE = {"ingredient.csv"}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def download_and_extract(target_dir: Path, *, ref: str = "main") -> None:
|
|
23
|
+
url = _TEMPLATE_URL.format(ref=ref)
|
|
24
|
+
response = httpx.get(url, follow_redirects=True, timeout=60)
|
|
25
|
+
response.raise_for_status()
|
|
26
|
+
|
|
27
|
+
with zipfile.ZipFile(io.BytesIO(response.content)) as zf:
|
|
28
|
+
root_prefix = _zip_root(zf)
|
|
29
|
+
target_dir.mkdir(parents=True, exist_ok=False)
|
|
30
|
+
for member in zf.infolist():
|
|
31
|
+
rel = member.filename[len(root_prefix):]
|
|
32
|
+
if not rel:
|
|
33
|
+
continue
|
|
34
|
+
dest = target_dir / rel
|
|
35
|
+
if member.is_dir():
|
|
36
|
+
dest.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
else:
|
|
38
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
39
|
+
dest.write_bytes(zf.read(member.filename))
|
|
40
|
+
|
|
41
|
+
_cleanup(target_dir)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _zip_root(zf: zipfile.ZipFile) -> str:
|
|
45
|
+
return zf.namelist()[0].split("/")[0] + "/"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _cleanup(target_dir: Path) -> None:
|
|
49
|
+
# Dirs (traverse deepest first to handle nested __pycache__)
|
|
50
|
+
for item in sorted(target_dir.rglob("*"), key=lambda p: len(p.parts), reverse=True):
|
|
51
|
+
if item.is_dir() and item.name in _DIRS_TO_REMOVE:
|
|
52
|
+
shutil.rmtree(item, ignore_errors=True)
|
|
53
|
+
elif item.is_file() and item.name in _FILES_TO_REMOVE:
|
|
54
|
+
item.unlink(missing_ok=True)
|
|
55
|
+
|
|
56
|
+
# Data files
|
|
57
|
+
data_dir = target_dir / "data"
|
|
58
|
+
if data_dir.exists():
|
|
59
|
+
for fname in _DATA_FILES_TO_REMOVE:
|
|
60
|
+
(data_dir / fname).unlink(missing_ok=True)
|
|
61
|
+
try:
|
|
62
|
+
data_dir.rmdir() # only succeeds if empty
|
|
63
|
+
except OSError:
|
|
64
|
+
pass
|
|
65
|
+
|
arclith_cli/updater.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
|
|
10
|
+
_INSTALL_URL = "git+https://github.com/karned-rekipe/framework.git#subdirectory=cli"
|
|
11
|
+
|
|
12
|
+
console = Console()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run_update(ref: str | None = None) -> None:
|
|
16
|
+
uv = shutil.which("uv")
|
|
17
|
+
if not uv:
|
|
18
|
+
console.print(
|
|
19
|
+
"[red]✗[/red] [bold]uv[/bold] introuvable dans le PATH.\n"
|
|
20
|
+
"Installez-le : [link=https://docs.astral.sh/uv/]https://docs.astral.sh/uv/[/link]"
|
|
21
|
+
)
|
|
22
|
+
raise typer.Exit(1)
|
|
23
|
+
|
|
24
|
+
url = _INSTALL_URL if not ref else _INSTALL_URL.replace(".git#", f".git@{ref}#")
|
|
25
|
+
console.print(f"[bold]Mise à jour depuis[/bold] [dim]{url}[/dim]")
|
|
26
|
+
|
|
27
|
+
result = subprocess.run([uv, "tool", "install", "--force", url])
|
|
28
|
+
if result.returncode == 0:
|
|
29
|
+
console.print("[green]✓[/green] arclith-cli mis à jour")
|
|
30
|
+
else:
|
|
31
|
+
console.print("[red]✗[/red] Échec de la mise à jour")
|
|
32
|
+
raise typer.Exit(result.returncode)
|
|
33
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arclith-cli
|
|
3
|
+
Version: 0.7.1
|
|
4
|
+
Summary: CLI scaffolding tool for arclith — hexagonal architecture framework
|
|
5
|
+
Author-email: Killian KOPP <killiankopp@gmail.com>
|
|
6
|
+
License: Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship made available under
|
|
41
|
+
the License, as indicated by a copyright notice that is included in
|
|
42
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
43
|
+
|
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
47
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
48
|
+
of this License, Derivative Works shall not include works that remain
|
|
49
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
50
|
+
the Work and its Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
53
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
54
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
55
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
56
|
+
or written communication sent to the Licensor or its representatives,
|
|
57
|
+
including but not limited to communication on electronic mailing lists,
|
|
58
|
+
source code control systems, and issue tracking systems that are managed
|
|
59
|
+
by, or on behalf of, the Licensor for the purpose of developing and
|
|
60
|
+
refining the Work, but excluding communication that is conspicuously
|
|
61
|
+
marked or designated in writing by the copyright owner as "Not a
|
|
62
|
+
Contribution."
|
|
63
|
+
|
|
64
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
65
|
+
whom a Contribution has been received by the Licensor and included
|
|
66
|
+
within the Work.
|
|
67
|
+
|
|
68
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
69
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
70
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
71
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
72
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
73
|
+
Work and such Derivative Works in Source or Object form.
|
|
74
|
+
|
|
75
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
76
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
+
(except as stated in this section) patent license to make, have made,
|
|
79
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
80
|
+
where such license applies only to those patent contributions
|
|
81
|
+
Licensable by such Contributor that are necessarily infringed by
|
|
82
|
+
their Contribution(s) alone or by the combination of their
|
|
83
|
+
Contribution(s) with the Work to which such Contribution(s) was
|
|
84
|
+
submitted. If You institute patent litigation against any entity
|
|
85
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
86
|
+
the Work or any Contribution embodied within the Work constitutes
|
|
87
|
+
direct or contributory patent infringement, then any patent licenses
|
|
88
|
+
granted to You under this License for that Work shall terminate as
|
|
89
|
+
of the date such litigation is filed.
|
|
90
|
+
|
|
91
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
92
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
93
|
+
modifications, and in Source or Object form, provided that You
|
|
94
|
+
meet the following conditions:
|
|
95
|
+
|
|
96
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
97
|
+
Works a copy of this License; and
|
|
98
|
+
|
|
99
|
+
(b) You must cause any modified files to carry prominent notices
|
|
100
|
+
stating that You changed the files; and
|
|
101
|
+
|
|
102
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
103
|
+
that You distribute, all copyright, patent, trademark, and
|
|
104
|
+
attribution notices from the Source form of the Work,
|
|
105
|
+
excluding those notices that do not pertain to any part of
|
|
106
|
+
the Derivative Works; and
|
|
107
|
+
|
|
108
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
109
|
+
distribution, You must include a readable copy of the
|
|
110
|
+
attribution notices contained within such NOTICE file, in
|
|
111
|
+
at least one of the following places: within a NOTICE text
|
|
112
|
+
file distributed as part of the Derivative Works; within
|
|
113
|
+
the Source form or documentation, if provided along with the
|
|
114
|
+
Derivative Works; or, within a display generated by the
|
|
115
|
+
Derivative Works, if and wherever such third-party notices
|
|
116
|
+
normally appear. The contents of the NOTICE file are for
|
|
117
|
+
informational purposes only and do not modify the License.
|
|
118
|
+
You may add Your own attribution notices within Derivative
|
|
119
|
+
Works that You distribute, alongside or in addition to the
|
|
120
|
+
NOTICE text from the Work, provided that such additional
|
|
121
|
+
attribution notices cannot be construed as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own license statement for Your modifications and
|
|
124
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
125
|
+
publish, distribute, sublicense, and/or sell copies of the Work.
|
|
126
|
+
|
|
127
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
128
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
129
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
130
|
+
this License, without any additional terms or conditions.
|
|
131
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
132
|
+
the terms of any separate license agreement you may have executed
|
|
133
|
+
with Licensor regarding such Contributions.
|
|
134
|
+
|
|
135
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
136
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
137
|
+
except as required for reasonable and customary use in describing the
|
|
138
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
139
|
+
|
|
140
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
141
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
142
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
143
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
144
|
+
implied, including, without limitation, any warranties or conditions
|
|
145
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
146
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
147
|
+
appropriateness of using or reproducing the Work and assume any
|
|
148
|
+
risks associated with Your exercise of permissions under this License.
|
|
149
|
+
|
|
150
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
151
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
152
|
+
unless required by applicable law (such as deliberate and grossly
|
|
153
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
154
|
+
liable to You for damages, including any direct, indirect, special,
|
|
155
|
+
incidental, or exemplary damages of any character arising as a
|
|
156
|
+
result of this License or out of the use or inability to use the
|
|
157
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
158
|
+
work stoppage, computer failure or malfunction, or all other
|
|
159
|
+
commercial damages or losses), even if such Contributor has been
|
|
160
|
+
advised of the possibility of such damages.
|
|
161
|
+
|
|
162
|
+
9. Accepting Warranty or Liability. While redistributing the Work or
|
|
163
|
+
Derivative Works thereof, You may choose to offer, and charge a fee
|
|
164
|
+
for, acceptance of support, warranty, indemnity, or other liability
|
|
165
|
+
obligations and/or rights consistent with this License. However, in
|
|
166
|
+
accepting such obligations, You may offer only conditions that
|
|
167
|
+
You alone are responsible for, and not on behalf of any other
|
|
168
|
+
Contributor.
|
|
169
|
+
|
|
170
|
+
END OF TERMS AND CONDITIONS
|
|
171
|
+
|
|
172
|
+
Copyright 2026 Killian KOPP
|
|
173
|
+
|
|
174
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
175
|
+
you may not use this file except in compliance with the License.
|
|
176
|
+
You may obtain a copy of the License at
|
|
177
|
+
|
|
178
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
179
|
+
|
|
180
|
+
Unless required by applicable law or agreed to in writing, software
|
|
181
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
182
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
183
|
+
See the License for the specific language governing permissions and
|
|
184
|
+
limitations under the License.
|
|
185
|
+
|
|
186
|
+
License-File: LICENSE
|
|
187
|
+
Keywords: arclith,cli,ddd,hexagonal-architecture,scaffold
|
|
188
|
+
Requires-Python: >=3.13
|
|
189
|
+
Requires-Dist: arclith>=0.7.0
|
|
190
|
+
Requires-Dist: httpx>=0.27.0
|
|
191
|
+
Requires-Dist: rich>=13.0.0
|
|
192
|
+
Requires-Dist: typer>=0.15.0
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
arclith_cli/__init__.py,sha256=IjL9_z1zvhHQzn_1nA_rVf-X3ZpSBJICvdOa6-dRorA,23
|
|
2
|
+
arclith_cli/adapter_templates.py,sha256=9sWKjnhDoBDKja-26Jlmpmp5yaJac5yZoug9y71aVdU,6535
|
|
3
|
+
arclith_cli/add_adapter.py,sha256=nBXlW2uXxZ1Vfe6VsaMGsa6RpJWK2GEBvsKXxrDXkBc,11509
|
|
4
|
+
arclith_cli/entity_scanner.py,sha256=Zeq6UmVjfVrlUJCoiGSzzl2TLmYl9T6PuqCKapByvLU,2033
|
|
5
|
+
arclith_cli/export_config.py,sha256=sl2xl4aiyjJIm9eZR1DoFNpBZl2bg6tMJ2jZp54-O-g,2513
|
|
6
|
+
arclith_cli/main.py,sha256=ApmUjTjxe0BmX1IpZ88rR_pTS3ecLLcwODmgZMPwlNk,7141
|
|
7
|
+
arclith_cli/rename.py,sha256=JK379M4XXyYzbzUBKrmxSbelXpOl-7uPjrEUoEEKCrE,5545
|
|
8
|
+
arclith_cli/scaffold.py,sha256=gmN7aLEpqpCKeCpsYNDynD87jxLb-gxKxsHDsFa6_Y0,2099
|
|
9
|
+
arclith_cli/updater.py,sha256=R5MYlOkmfAk-LgjH1FsANWFQpnOIiZ5XPsmuo8A8m0w,1022
|
|
10
|
+
arclith_cli-0.7.1.dist-info/METADATA,sha256=1Xo_C23YM9IfZp6x9nrVJh1QPtp11YZcbIiyk1kvjK4,11770
|
|
11
|
+
arclith_cli-0.7.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
12
|
+
arclith_cli-0.7.1.dist-info/entry_points.txt,sha256=pE4QclsDOtfvGsOXqo8pJTX6KR5RBwgkmx7GjTGO22Q,53
|
|
13
|
+
arclith_cli-0.7.1.dist-info/licenses/LICENSE,sha256=7IxeTKTBGYEHZK09nS5neiX9qnFGjmD0ssUg2eApX9c,9924
|
|
14
|
+
arclith_cli-0.7.1.dist-info/RECORD,,
|