Skip to content

Commit d353c32

Browse files
committed
feat: implement dynamic CLI logo with LogoRenderer class
- Add LogoRenderer class for dynamic version rendering - Logo displays actual package version from __version__ - Logo only shows when running 'agently' without subcommands - Follow TDD: comprehensive test coverage (12 new tests) - Follow UI component pattern for separation of concerns - All tests pass (21 total), lint and type-check clean
1 parent a05870e commit d353c32

24 files changed

Lines changed: 4340 additions & 75 deletions

.DS_Store

2 KB
Binary file not shown.

AGENTS.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# PROJECT KNOWLEDGE BASE
2+
3+
**Generated:** 2026-03-08T01:50:33Z
4+
**Commit:** aa06bf3
5+
**Branch:** master
6+
7+
## OVERVIEW
8+
AI-driven programming assistant for software development lifecycle using multi-agent coordination. Python 3.9+ with Click CLI, LangChain integration, and comprehensive code understanding.
9+
10+
## STRUCTURE
11+
```
12+
agently/
13+
├── src/agently/
14+
│ ├── core/ # LLM, Tools, Skills, CodeUnderstanding
15+
│ ├── orchestrator/ # Nexus, Planner, Scheduler, Workflow, State
16+
│ ├── agents/ # BaseAgent, Specialist agents, NexusAgent
17+
│ ├── infrastructure/ # FileSystem, Git, StateStorage
18+
│ ├── constraints/ # Concurrency, Memory, Security, Timing
19+
│ └── cli/ # Click-based command interface
20+
├── tests/unit/ # Organized by module
21+
├── docs/ # Architecture, user guides
22+
└── config/ # Environment configs
23+
```
24+
25+
## WHERE TO LOOK
26+
| Task | Location | Notes |
27+
|------|----------|-------|
28+
| CLI entry | `src/agently/cli/main.py` | Click-based, commands: chat/ask/agent/config/task |
29+
| Core services | `src/agently/core/` | LLM, Tools, Skills, CodeUnderstanding |
30+
| Agent coordination | `src/agently/orchestrator/` | Nexus, Planner, Scheduler, Workflow, State |
31+
| Agent implementations | `src/agently/agents/` | BaseAgent, Specialist, NexusAgent |
32+
| Infrastructure | `src/agently/infrastructure/` | File, Git, State services |
33+
| Constraints | `src/agently/constraints/` | Resource management: concurrency/memory/security/timing |
34+
| Config | `src/agently/config.py` | Settings from env/file, integrates constraints |
35+
36+
## CONVENTIONS
37+
38+
**Python:**
39+
- Line length: 100 chars (ruff)
40+
- Type hints required (mypy strict mode)
41+
- Docstrings: Google-style with Args/Returns/Raises
42+
- `__init__.py`: Unused imports allowed (F401)
43+
44+
**Testing:**
45+
- pytest with coverage (terminal + HTML)
46+
- Markers: unit, integration, slow
47+
- Tests in `tests/unit/{module}/`
48+
49+
**Build/CI:**
50+
- Makefile: install, test, lint (ruff), format, type-check (mypy), docs
51+
- GitHub Actions: ci.yml, release.yml, docs.yml
52+
- Package: hatchling
53+
54+
**Logging:**
55+
- Structured logging via structlog
56+
- `agently.logging` module for consistent formatting
57+
58+
## ANTI-PATTERNS (THIS PROJECT)
59+
60+
**Security constraints** (`src/agently/constraints/security.py`):
61+
- Blocked shell patterns: `rm -rf`, `mkfs`, `format`, `dd`, `:(){:|:&};:`
62+
63+
**File operations** (`src/agently/infrastructure/file_system.py`):
64+
- Always validate paths before operations
65+
- Use context managers for file handles
66+
67+
**Concurrency limits** (`src/agently/constraints/concurrency.py`):
68+
- Max 5 concurrent operations by default
69+
- Session cleanup when threshold exceeded
70+
71+
## UNIQUE STYLES
72+
73+
**Multi-agent architecture:**
74+
- Nexus orchestrator coordinates specialist agents
75+
- Capability-based routing (keyword matching)
76+
- AgentContext maintains history across executions
77+
78+
**Tool/Skill system:**
79+
- Registry pattern for dynamic registration
80+
- LangChain integration for external tools
81+
- Skills compose complex workflows from primitives
82+
83+
**Code understanding:**
84+
- AST-based static analysis (504-line service)
85+
- Extracts functions, classes, dependencies
86+
- Call graph generation
87+
88+
## COMMANDS
89+
```bash
90+
make install # Install dependencies
91+
make test # Run tests with coverage
92+
make lint # Ruff linting
93+
make format # Ruff formatting
94+
make type-check # MyPy type checking
95+
make build # Build package
96+
make docs # Generate docs
97+
```
98+
99+
## NOTES
100+
101+
**Complexity hotspots:**
102+
- `src/agently/core/code_understanding.py` (504 lines) - AST parsing, call graphs
103+
- `src/agently/orchestrator/` - Multi-agent coordination logic
104+
105+
**Stub implementations:**
106+
- CLI commands mostly placeholder ("coming soon!")
107+
- Many specialist agents stubbed (`return {"fixed": True}`)
108+
109+
**Documentation:**
110+
- Chinese descriptions, English code/comments
111+
- Architecture docs in `docs/` with Mermaid diagrams
112+
113+
**Dependencies:**
114+
- Core: Click, Pydantic, LangChain
115+
- Analysis: tree-sitter for parsing
116+
- Git: GitPython
117+
- Storage: aiosqlite (planned, using JSON currently)
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# CLI Logo 实现计划
2+
3+
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4+
5+
**Goal:** 为 Agently CLI 添加清晰显示 AGENTLY 字符的 Logo,仅在运行 `agently` 命令(不带子命令)时显示
6+
7+
**架构:** 在 CLI 主入口添加 Logo 常量,修改 cli() 函数,仅在运行 `agently` 命令(不带子命令)时显示 Logo
8+
9+
**技术栈:** Python, Click
10+
11+
---
12+
13+
## 前置条件
14+
15+
- 已选择方案一(大方块风格 Logo,显示 AGENTLY,字符间距一致)
16+
- 设计文档已保存至 `docs/plans/2026-03-08-cli-logo-design.md`
17+
- 指令保持为 `agently`,不需要修改
18+
19+
---
20+
21+
## Task 1: 在 main.py 中添加 Logo 常量
22+
23+
**Files:**
24+
- Modify: `src/agently/cli/main.py:1-15`
25+
26+
**Step 1: 在文件顶部添加 Logo 常量**
27+
28+
在 imports 之后,`@click.group()` 之前添加:
29+
30+
```python
31+
LOGO = """
32+
▄▀█ █▀▀ █▀▀ █▄░█ ▀█▀ █░░ █▄█
33+
█▀█ █▄█ ██▄ █░▀█ ░█░ █▄▄ ░█░
34+
35+
🤖 Agently v0.1.0 | AI-Driven Programming Assistant
36+
────────────────────────────────────────────────────
37+
Tips: Run 'agently --help' to see available commands
38+
"""
39+
```
40+
41+
**Step 2: Commit**
42+
43+
```bash
44+
git add src/agently/cli/main.py
45+
git commit -m "feat: add ASCII logo constant to CLI main module"
46+
```
47+
48+
---
49+
50+
## Task 2: 修改 cli() 函数添加 Logo 显示逻辑
51+
52+
**Files:**
53+
- Modify: `src/agently/cli/main.py:29-47` (cli 函数)
54+
55+
**Step 1: 修改 cli() 函数**
56+
57+
`@click.group()` 改为 `@click.group(invoke_without_command=True)`,并添加 Logo 显示逻辑:
58+
59+
```python
60+
@click.group(invoke_without_command=True)
61+
@click.version_option(version="0.1.0")
62+
@click.pass_context
63+
def cli(ctx: click.Context) -> None:
64+
"""Agently - AI-driven programming assistant"""
65+
ctx.ensure_object(dict)
66+
67+
# 只在不带子命令时显示 logo
68+
if ctx.invoked_subcommand is None:
69+
click.echo(LOGO)
70+
click.echo(ctx.get_help())
71+
```
72+
73+
**Step 2: Commit**
74+
75+
```bash
76+
git add src/agently/cli/main.py
77+
git commit -m "feat: display logo only when running 'agently' without subcommand"
78+
```
79+
80+
---
81+
82+
## Task 3: 本地测试验证
83+
84+
**Step 1: 重新安装包**
85+
86+
```bash
87+
pip install -e .
88+
```
89+
90+
**Step 2: 测试 Logo 显示**
91+
92+
```bash
93+
agently
94+
```
95+
96+
**Expected Output:**
97+
- 显示 Logo
98+
- 然后显示帮助信息
99+
100+
**Step 3: 测试其他命令不显示 Logo**
101+
102+
```bash
103+
agently --help
104+
agently version
105+
agently agent list
106+
```
107+
108+
**Expected:** 这些命令不显示 Logo
109+
110+
**Step 4: Commit(如有测试文件修改)**
111+
112+
```bash
113+
git add .
114+
git commit -m "test: verify CLI logo display behavior"
115+
```
116+
117+
---
118+
119+
## Task 4: 运行测试套件
120+
121+
**Step 1: 运行单元测试**
122+
123+
```bash
124+
make test
125+
```
126+
127+
128+
129+
```bash
130+
pytest tests/unit/cli/ -v
131+
```
132+
133+
**Expected:** 所有测试通过
134+
135+
**Step 2: 运行代码检查**
136+
137+
```bash
138+
make lint
139+
make type-check
140+
```
141+
142+
**Step 3: Commit**
143+
144+
```bash
145+
git add .
146+
git commit -m "chore: pass all tests and lint checks"
147+
```
148+
149+
---
150+
151+
## 验收标准
152+
153+
- [ ] 运行 `agently` 时显示 Logo
154+
- [ ] 运行 `agently --help` 时不显示 Logo
155+
- [ ] 运行 `agently version` 时不显示 Logo
156+
- [ ] 运行 `agently chat` 时不显示 Logo
157+
- [ ] Logo 字符清晰,无乱码
158+
- [ ] 所有单元测试通过
159+
- [ ] 代码通过 lint 检查
160+
161+
---
162+
163+
## 注意事项
164+
165+
1. Logo 使用 Unicode 字符,确保终端支持 UTF-8
166+
2. 如果终端宽度不足,Logo 可能会换行显示
167+
3. 后续可考虑添加 `--no-logo` 选项来禁用 Logo 显示

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dependencies = [
4747
"langchain-openai>=0.2.0",
4848
"langchain-anthropic>=0.2.0",
4949
"langchain-google-genai>=2.0.0",
50+
"langgraph>=0.2.0",
5051

5152
# Code analysis
5253
"tree-sitter>=0.20.0",

0 commit comments

Comments
 (0)