Skip to content

Commit

Permalink
refactor: rename project and related references to 'ai-cli'
Browse files Browse the repository at this point in the history
- Update import aliases in .ruff.toml
- Replace 'llm-cli' with 'ai-cli' in README.md, docs, and scripts
- Rename project in pyproject.toml and update related URLs
- Adjust internal module paths and references
  • Loading branch information
liblaf committed Nov 30, 2024
1 parent 9e04a97 commit ea2baaf
Show file tree
Hide file tree
Showing 73 changed files with 152 additions and 164 deletions.
8 changes: 4 additions & 4 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extend = ".github/linters/.ruff.toml"

[lint.flake8-import-conventions.aliases]
"llm_cli" = "lc"
"llm_cli.cmd" = "lcm"
"llm_cli.config" = "lcc"
"llm_cli.utils" = "lcu"
"ai" = "ai"
"ai.cmd" = "aim"
"ai.config" = "aic"
"ai.utils" = "aiu"
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,46 @@ LLM CLI is a powerful, open-source command-line interface for AI-driven reposito

</div>

[pypi-release-shield]: https://img.shields.io/pypi/v/liblaf-llm-cli?logo=pypi&style=flat&label=PyPI
[pypi-release-link]: https://pypi.org/project/liblaf-llm-cli/
[github-releasedate-shield]: https://img.shields.io/github/release-date/liblaf/llm-cli?style=flat
[github-releasedate-link]: https://github.com/liblaf/llm-cli/releases
[github-action-ci-shield]: https://img.shields.io/github/actions/workflow/status/liblaf/llm-cli/ci.yaml?label=ci&logo=githubactions&logoColor=white&style=flat
[github-action-ci-link]: https://github.com/liblaf/llm-cli/actions/workflows/ci.yaml
[github-contributors-shield]: https://img.shields.io/github/contributors/liblaf/llm-cli?color=c4f042&style=flat
[github-contributors-link]: https://github.com/liblaf/llm-cli/graphs/contributors
[github-forks-shield]: https://img.shields.io/github/forks/liblaf/llm-cli?color=8ae8ff&style=flat
[github-forks-link]: https://github.com/liblaf/llm-cli/forks
[github-stars-shield]: https://img.shields.io/github/stars/liblaf/llm-cli?color=ffcb47&style=flat
[github-stars-link]: https://github.com/liblaf/llm-cli/stargazers
[github-issues-shield]: https://img.shields.io/github/issues/liblaf/llm-cli?color=ff80eb&style=flat
[github-issues-link]: https://github.com/liblaf/llm-cli/issues
[github-license-shield]: https://img.shields.io/github/license/liblaf/llm-cli?color=white&style=flat
[github-license-link]: https://github.com/liblaf/llm-cli/blob/main/LICENSE
[pypi-release-shield]: https://img.shields.io/pypi/v/liblaf-ai-cli?logo=pypi&style=flat&label=PyPI
[pypi-release-link]: https://pypi.org/project/liblaf-ai-cli/
[github-releasedate-shield]: https://img.shields.io/github/release-date/liblaf/ai-cli?style=flat
[github-releasedate-link]: https://github.com/liblaf/ai-cli/releases
[github-action-ci-shield]: https://img.shields.io/github/actions/workflow/status/liblaf/ai-cli/ci.yaml?label=ci&logo=githubactions&logoColor=white&style=flat
[github-action-ci-link]: https://github.com/liblaf/ai-cli/actions/workflows/ci.yaml
[github-contributors-shield]: https://img.shields.io/github/contributors/liblaf/ai-cli?color=c4f042&style=flat
[github-contributors-link]: https://github.com/liblaf/ai-cli/graphs/contributors
[github-forks-shield]: https://img.shields.io/github/forks/liblaf/ai-cli?color=8ae8ff&style=flat
[github-forks-link]: https://github.com/liblaf/ai-cli/forks
[github-stars-shield]: https://img.shields.io/github/stars/liblaf/ai-cli?color=ffcb47&style=flat
[github-stars-link]: https://github.com/liblaf/ai-cli/stargazers
[github-issues-shield]: https://img.shields.io/github/issues/liblaf/ai-cli?color=ff80eb&style=flat
[github-issues-link]: https://github.com/liblaf/ai-cli/issues
[github-license-shield]: https://img.shields.io/github/license/liblaf/ai-cli?color=white&style=flat
[github-license-link]: https://github.com/liblaf/ai-cli/blob/main/LICENSE

## 📦 Installation

To install `llm-cli`, run the following command:
To install `ai-cli`, run the following command:

```bash
uv tool install liblaf-llm-cli
uv tool install liblaf-ai-cli
```

or

```bash
pipx install liblaf-llm-cli
pipx install liblaf-ai-cli
```

## ⌨️ Local Development

You can clone it for local development:

```bash
gh repo clone liblaf/llm-cli
cd llm-cli
gh repo clone liblaf/ai-cli
cd ai-cli
uv sync --all-extras
llm-cli --help
ai-cli --help
```

## 🤝 Contributing
Expand All @@ -78,9 +78,9 @@ Contributions of all types are more than welcome, if you are interested in contr
</div>

[pr-welcome-shield]: https://img.shields.io/badge/%F0%9F%A4%AF%20PR%20WELCOME-%E2%86%92-ffcb47?labelColor=black&style=for-the-badge
[pr-welcome-link]: https://github.com/liblaf/llm-cli/pulls
[github-contrib-shield]: https://contrib.rocks/image?repo=liblaf%2Fllm-cli
[github-contrib-link]: https://github.com/liblaf/llm-cli/graphs/contributors
[pr-welcome-link]: https://github.com/liblaf/ai-cli/pulls
[github-contrib-shield]: https://contrib.rocks/image?repo=liblaf%2Fai-cli
[github-contrib-link]: https://github.com/liblaf/ai-cli/graphs/contributors
[back-to-top]: https://img.shields.io/badge/-BACK_TO_TOP-black?style=flat-square

---
Expand Down
2 changes: 1 addition & 1 deletion docs/config/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#:schema https://github.com/liblaf/llm-cli/raw/refs/heads/main/docs/schema/config.json
#:schema https://github.com/liblaf/ai-cli/raw/refs/heads/main/docs/schema/config.json
[completion]
model = "deepseek-chat"

Expand Down
20 changes: 10 additions & 10 deletions docs/help.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# `llm-cli`
# `ai-cli`

**Usage**:

```console
llm-cli [OPTIONS] COMMAND [ARGS]...
ai-cli [OPTIONS] COMMAND [ARGS]...
```

**Options**:
Expand All @@ -15,12 +15,12 @@ llm-cli [OPTIONS] COMMAND [ARGS]...
- `commit`
- `repo`

## `llm-cli commit`
## `ai-cli commit`

**Usage**:

```console
llm-cli commit [OPTIONS] [PATH]...
ai-cli commit [OPTIONS] [PATH]...
```

**Arguments**:
Expand All @@ -34,12 +34,12 @@ llm-cli commit [OPTIONS] [PATH]...
- `--model TEXT`
- `--help`: Show this message and exit.

## `llm-cli repo`
## `ai-cli repo`

**Usage**:

```console
llm-cli repo [OPTIONS] COMMAND [ARGS]...
ai-cli repo [OPTIONS] COMMAND [ARGS]...
```

**Options**:
Expand All @@ -51,25 +51,25 @@ llm-cli repo [OPTIONS] COMMAND [ARGS]...
- `description`
- `topics`

### `llm-cli repo description`
### `ai-cli repo description`

**Usage**:

```console
llm-cli repo description [OPTIONS]
ai-cli repo description [OPTIONS]
```

**Options**:

- `--model TEXT`
- `--help`: Show this message and exit.

### `llm-cli repo topics`
### `ai-cli repo topics`

**Usage**:

```console
llm-cli repo topics [OPTIONS]
ai-cli repo topics [OPTIONS]
```

**Options**:
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ dependencies = [
"typer>=0.13.1",
]
description = "🚀 LLM CLI - a powerful, open-source command-line interface for AI-driven repository management. Simplifies commit message generation, repository description, and topic suggestion, enhancing productivity and collaboration for developers."
name = "liblaf-llm-cli"
name = "liblaf-ai-cli"
readme = "README.md"
requires-python = ">=3.12"
version = "0.0.0"

[project.scripts]
aic = "llm_cli.cmd.commit:app"
llm-cli = "llm_cli:app"
ai = "ai:app"
aic = "ai.cmd.commit:app"

[project.urls]
"Changelog" = "https://github.com/liblaf/llm-cli/blob/main/CHANGELOG.md"
"Homepage" = "https://github.com/liblaf/llm-cli"
"Issue Tracker" = "https://github.com/liblaf/llm-cli/issues"
"Release Notes" = "https://github.com/liblaf/llm-cli/releases"
"Source Code" = "https://github.com/liblaf/llm-cli"
"Changelog" = "https://github.com/liblaf/ai-cli/blob/main/CHANGELOG.md"
"Homepage" = "https://github.com/liblaf/ai-cli"
"Issue Tracker" = "https://github.com/liblaf/ai-cli/issues"
"Release Notes" = "https://github.com/liblaf/ai-cli/releases"
"Source Code" = "https://github.com/liblaf/ai-cli"

[tool.hatch.build.targets.wheel]
packages = ["src/llm_cli"]
packages = ["src/ai"]
2 changes: 1 addition & 1 deletion scripts/gen-help.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail

typer llm_cli utils docs --output docs/help.md
typer ai_cli utils docs --output docs/help.md
prettier --write docs/help.md
markdownlint --fix docs/help.md
2 changes: 1 addition & 1 deletion scripts/gen-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -o errexit -o nounset -o pipefail

git_root=$(git rev-parse --show-toplevel)
src_dir=$git_root/src/llm_cli
src_dir=$git_root/src/ai_cli

readarray -t dpaths < <(find "$src_dir" -type d)
for dpath in "${dpaths[@]}"; do
Expand Down
4 changes: 2 additions & 2 deletions scripts/gen-schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import subprocess
from pathlib import Path

import llm_cli.config as lcc
import ai.config as aic


def main() -> None:
output: Path = Path("docs/schema/config.json")
output.write_text(json.dumps(lcc.Config.model_json_schema()))
output.write_text(json.dumps(aic.Config.model_json_schema()))
subprocess.run(["prettier", "--write", output], check=True)


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/ai/cmd/_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import typer_di

import ai.cmd as aim
import ai.utils as aiu

app = typer_di.TyperDI(name="ai-cli", no_args_is_help=True)
aiu.add_command(app, aim.repo.app)
aiu.add_command(app, aim.commit.app)
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/llm_cli/cmd/commit/_app.py → src/ai/cmd/commit/_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import typer
import typer_di

import llm_cli.utils as lcu
import ai.utils as aiu

app = typer_di.TyperDI(name="commit")

Expand All @@ -15,7 +15,7 @@ def main(
*,
default_exclude: Annotated[bool, typer.Option()] = True,
verify: Annotated[bool, typer.Option()] = True,
_: None = typer_di.Depends(lcu.get_config),
_: None = typer_di.Depends(aiu.get_config),
) -> None:
from ._main import main

Expand Down
14 changes: 7 additions & 7 deletions src/llm_cli/cmd/commit/_main.py → src/ai/cmd/commit/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
import litellm
import typer

import llm_cli as lc
import llm_cli.utils as lcu
import ai
import ai.utils as aiu


async def main(path: list[str], *, verify: bool = True) -> None:
await lcu.run("git", "status", *path)
prompt_template = string.Template(lcu.get_prompt("commit"))
await aiu.run("git", "status", *path)
prompt_template = string.Template(aiu.get_prompt("commit"))
repo = git.Repo(search_parent_directories=True)
diff: str = repo.git.diff("--cached", "--no-ext-diff", *path)
files: str = repo.git.ls_files()
prompt: str = prompt_template.substitute({"GIT_DIFF": diff, "GIT_FILES": files})
resp: litellm.ModelResponse = await lc.output(prompt, prefix="<Answer>")
resp: litellm.ModelResponse = await ai.output(prompt, prefix="<Answer>")
content: str = litellm.get_content_from_model_response(resp)
message: str = lcu.extract_between_tags(content)
proc: asyncio.subprocess.Process = await lcu.run(
message: str = aiu.extract_between_tags(content)
proc: asyncio.subprocess.Process = await aiu.run(
"git",
"commit",
f"--message={message}",
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/ai/cmd/repo/_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import typer_di

import ai.utils as aiu
from ai import cmd as aim

app = typer_di.TyperDI(name="repo", no_args_is_help=True)
aiu.add_command(app, aim.repo.description.app)
aiu.add_command(app, aim.repo.topics.app)
10 changes: 5 additions & 5 deletions src/llm_cli/cmd/repo/_main.py → src/ai/cmd/repo/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import tempfile
from pathlib import Path

import llm_cli as lc
import llm_cli.utils as lcu
import ai
import ai.utils as aiu


async def main(instruction: str) -> None:
Expand All @@ -15,9 +15,9 @@ async def main(instruction: str) -> None:
instruction_fpath: Path = tmpdir / "repomix-instruction.md"
instruction_fpath.write_text(_get_instruction(instruction))
config_fpath.write_text(_get_config(tmpdir, instruction_fpath))
await lcu.run("repomix", "--config", config_fpath)
await aiu.run("repomix", "--config", config_fpath)
prompt: str = output_file_path.read_text()
await lc.output(prompt, prefix="<answer>", stop="</answer>")
await ai.output(prompt, prefix="<answer>", stop="</answer>")


def _get_config(tmpdir: Path, instruction_fpath: Path) -> str:
Expand Down Expand Up @@ -46,5 +46,5 @@ def _get_instruction(instruction: str) -> str:
if instruction_fpath.is_file():
return Path(instruction).read_text()
return importlib.resources.read_text(
"llm_cli.assets.instructions", f"{instruction}.md"
"ai_cli.assets.instructions", f"{instruction}.md"
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import typer_di

import llm_cli.utils as lcu
import ai.utils as aiu

app = typer_di.TyperDI(name="description")


@app.command()
def main(_: None = typer_di.Depends(lcu.get_config)) -> None:
def main(_: None = typer_di.Depends(aiu.get_config)) -> None:
from ._main import main

asyncio.run(main())
8 changes: 8 additions & 0 deletions src/ai/cmd/repo/description/_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ai
import ai.utils as aiu


async def main() -> None:
instruction: str = aiu.get_prompt("description")
prompt: str = await aiu.repomix(instruction)
await ai.output(prompt, prefix="<Answer>")
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import typer_di

import llm_cli.utils as lcu
import ai.utils as aiu

app = typer_di.TyperDI(name="topics")


@app.command()
def main(_: None = typer_di.Depends(lcu.get_config)) -> None:
def main(_: None = typer_di.Depends(aiu.get_config)) -> None:
from ._main import main

asyncio.run(main())
8 changes: 8 additions & 0 deletions src/ai/cmd/repo/topics/_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ai
import ai.utils as aiu


async def main() -> None:
instruction: str = aiu.get_prompt("topics")
prompt: str = await aiu.repomix(instruction)
await ai.output(prompt, prefix="<Answer>")
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ea2baaf

Please sign in to comment.