renaming from mybot to myclaude
This commit is contained in:
@@ -712,3 +712,21 @@
|
||||
**Git 分支**: $(git branch --show-current 2>/dev/null || echo 'N/A')
|
||||
**最近提交**: $(git log -1 --oneline 2>/dev/null || echo 'N/A')
|
||||
|
||||
---
|
||||
**会话结束**: $(date '+%Y-%m-%d %H:%M:%S')
|
||||
**工作目录**: $(pwd)
|
||||
**Git 分支**: $(git branch --show-current 2>/dev/null || echo 'N/A')
|
||||
**最近提交**: $(git log -1 --oneline 2>/dev/null || echo 'N/A')
|
||||
|
||||
---
|
||||
**会话结束**: $(date '+%Y-%m-%d %H:%M:%S')
|
||||
**工作目录**: $(pwd)
|
||||
**Git 分支**: $(git branch --show-current 2>/dev/null || echo 'N/A')
|
||||
**最近提交**: $(git log -1 --oneline 2>/dev/null || echo 'N/A')
|
||||
|
||||
---
|
||||
**会话结束**: $(date '+%Y-%m-%d %H:%M:%S')
|
||||
**工作目录**: $(pwd)
|
||||
**Git 分支**: $(git branch --show-current 2>/dev/null || echo 'N/A')
|
||||
**最近提交**: $(git log -1 --oneline 2>/dev/null || echo 'N/A')
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ ROOT_DIR := $(shell pwd)
|
||||
help:
|
||||
@echo "Usage: make [target]"
|
||||
@echo ""
|
||||
@echo " install Editable pip install of mybot (uses uv when available)"
|
||||
@echo " install Editable pip install of myclaude (uses uv when available)"
|
||||
|
||||
install:
|
||||
@if command -v uv >/dev/null 2>&1; then \
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
from mybot.cli import main
|
||||
|
||||
main()
|
||||
@@ -0,0 +1,3 @@
|
||||
from myclaude.cli import main
|
||||
|
||||
main()
|
||||
@@ -1,15 +1,15 @@
|
||||
"""Mybot CLI entrypoint."""
|
||||
"""Myclaude CLI entrypoint."""
|
||||
|
||||
from importlib.metadata import PackageNotFoundError, version
|
||||
|
||||
import click
|
||||
|
||||
from mybot.commands import chat_cmd, update_cmd
|
||||
from myclaude.commands import chat_cmd, update_cmd
|
||||
|
||||
|
||||
def _package_version() -> str:
|
||||
try:
|
||||
return version("mybot")
|
||||
return version("myclaude")
|
||||
except PackageNotFoundError:
|
||||
return "0.0.0"
|
||||
|
||||
@@ -17,7 +17,7 @@ def _package_version() -> str:
|
||||
@click.group()
|
||||
@click.version_option(version=_package_version())
|
||||
def cli() -> None:
|
||||
"""Mybot: CLI (update package, chat = Claude Code in this repo)."""
|
||||
"""Myclaude: CLI (update package, chat = Claude Code in this repo)."""
|
||||
|
||||
|
||||
cli.add_command(update_cmd)
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Start Claude Code in the mybot project directory."""
|
||||
"""Start Claude Code in the myclaude project directory."""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
@@ -9,18 +9,18 @@ from pathlib import Path
|
||||
import click
|
||||
from rich.console import Console
|
||||
|
||||
from mybot.project_root import get_mybot_project_root
|
||||
from myclaude.project_root import get_myclaude_project_root
|
||||
|
||||
console = Console()
|
||||
|
||||
|
||||
def _resolve_chat_cwd() -> Path:
|
||||
root = get_mybot_project_root()
|
||||
fallback = Path.home() / ".mybot"
|
||||
root = get_myclaude_project_root()
|
||||
fallback = Path.home() / ".myclaude"
|
||||
if root == fallback:
|
||||
console.print(
|
||||
"[red]Cannot resolve mybot project root.[/red] Run from the repo or set "
|
||||
"[cyan]MYBOT_PROJECT_ROOT[/cyan].",
|
||||
"[red]Cannot resolve myclaude project root.[/red] Run from the repo or set "
|
||||
"[cyan]MYCLAUDE_PROJECT_ROOT[/cyan].",
|
||||
file=sys.stderr,
|
||||
)
|
||||
raise SystemExit(1)
|
||||
@@ -42,7 +42,7 @@ def _resolve_chat_cwd() -> Path:
|
||||
)
|
||||
@click.pass_context
|
||||
def chat_cmd(ctx: click.Context, dangerously_skip_permissions: bool) -> None:
|
||||
"""Run `claude` in the mybot repo so CLAUDE.md and .claude/ apply; extra args pass through."""
|
||||
"""Run `claude` in the myclaude repo so CLAUDE.md and .claude/ apply; extra args pass through."""
|
||||
binary = os.environ.get("CLAUDE_BIN") or shutil.which("claude")
|
||||
if not binary:
|
||||
console.print(
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Reinstall mybot from the local repo."""
|
||||
"""Reinstall myclaude from the local repo."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
import click
|
||||
from rich.console import Console
|
||||
|
||||
from mybot.project_root import get_mybot_project_root
|
||||
from myclaude.project_root import get_myclaude_project_root
|
||||
|
||||
console = Console()
|
||||
|
||||
@@ -27,18 +27,18 @@ def _run_pip_editable(root: Path) -> int:
|
||||
|
||||
@click.command("update")
|
||||
def update_cmd() -> None:
|
||||
"""Reinstall mybot from this repository (make install, or pip install -e)."""
|
||||
root = get_mybot_project_root()
|
||||
fallback = Path.home() / ".mybot"
|
||||
"""Reinstall myclaude from this repository (make install, or pip install -e)."""
|
||||
root = get_myclaude_project_root()
|
||||
fallback = Path.home() / ".myclaude"
|
||||
if root == fallback:
|
||||
console.print(
|
||||
"[red]Not inside mybot repo.[/red] Set [cyan]MYBOT_PROJECT_ROOT[/cyan] "
|
||||
"[red]Not inside myclaude repo.[/red] Set [cyan]MYCLAUDE_PROJECT_ROOT[/cyan] "
|
||||
"or run from the clone.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
raise SystemExit(1)
|
||||
|
||||
console.print("[bold cyan]Updating mybot…[/bold cyan]")
|
||||
console.print("[bold cyan]Updating myclaude…[/bold cyan]")
|
||||
makefile = root / "Makefile"
|
||||
if makefile.is_file():
|
||||
rc = _run_make_install(root)
|
||||
@@ -51,4 +51,4 @@ def update_cmd() -> None:
|
||||
if rc != 0:
|
||||
console.print("[red]Update failed.[/red]", file=sys.stderr)
|
||||
raise SystemExit(rc)
|
||||
console.print("[green]mybot updated.[/green]")
|
||||
console.print("[green]myclaude updated.[/green]")
|
||||
@@ -1,22 +1,22 @@
|
||||
"""Resolve mybot repository root for make / editable install flows."""
|
||||
"""Resolve myclaude repository root for make / editable install flows."""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def _pyproject_names_mybot(path: Path) -> bool:
|
||||
def _pyproject_names_myclaude(path: Path) -> bool:
|
||||
try:
|
||||
text = path.read_text(encoding="utf-8", errors="ignore")
|
||||
except OSError:
|
||||
return False
|
||||
return 'name = "mybot"' in text or "name = 'mybot'" in text
|
||||
return 'name = "myclaude"' in text or "name = 'myclaude'" in text
|
||||
|
||||
|
||||
def _walk_up_for_pyproject(start: Path) -> Path | None:
|
||||
p = start.resolve()
|
||||
for _ in range(16):
|
||||
candidate = p / "pyproject.toml"
|
||||
if candidate.is_file() and _pyproject_names_mybot(candidate):
|
||||
if candidate.is_file() and _pyproject_names_myclaude(candidate):
|
||||
return p
|
||||
parent = p.parent
|
||||
if parent == p:
|
||||
@@ -25,13 +25,13 @@ def _walk_up_for_pyproject(start: Path) -> Path | None:
|
||||
return None
|
||||
|
||||
|
||||
def get_mybot_project_root() -> Path:
|
||||
def get_myclaude_project_root() -> Path:
|
||||
"""
|
||||
Root of the mybot repo (contains Makefile + pyproject).
|
||||
Root of the myclaude repo (contains Makefile + pyproject).
|
||||
|
||||
Order: MYBOT_PROJECT_ROOT > walk from cwd > package source tree > ~/.mybot
|
||||
Order: MYCLAUDE_PROJECT_ROOT > walk from cwd > package source tree > ~/.myclaude
|
||||
"""
|
||||
env_root = os.environ.get("MYBOT_PROJECT_ROOT")
|
||||
env_root = os.environ.get("MYCLAUDE_PROJECT_ROOT")
|
||||
if env_root:
|
||||
return Path(env_root).resolve()
|
||||
|
||||
@@ -47,10 +47,10 @@ def get_mybot_project_root() -> Path:
|
||||
here = Path(__file__).resolve().parent
|
||||
for _ in range(8):
|
||||
pyproject = here / "pyproject.toml"
|
||||
if pyproject.is_file() and _pyproject_names_mybot(pyproject):
|
||||
if pyproject.is_file() and _pyproject_names_myclaude(pyproject):
|
||||
return here
|
||||
if here.parent == here:
|
||||
break
|
||||
here = here.parent
|
||||
|
||||
return Path.home() / ".mybot"
|
||||
return Path.home() / ".myclaude"
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "mybot"
|
||||
name = "myclaude"
|
||||
version = "0.1.0"
|
||||
description = "Mybot CLI: package update and Claude Code launcher for this repo"
|
||||
description = "Myclaude CLI: package update and Claude Code launcher for this repo"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
"click>=8.0.0",
|
||||
@@ -9,14 +9,14 @@ dependencies = [
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
mybot = "mybot.cli:cli"
|
||||
myclaude = "myclaude.cli:cli"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["mybot"]
|
||||
packages = ["myclaude"]
|
||||
|
||||
[tool.black]
|
||||
line-length = 80
|
||||
|
||||
Reference in New Issue
Block a user