Skip to content

Commit 9f184f0

Browse files
elifarleyclaude
andcommitted
Refactor CLI to sub-command structure and update documentation
- Convert from single command to Click group with 'ls' sub-command - All existing functionality now available as 'cedarmapper ls [PATH] [OPTIONS]' - Update CLI usage examples in .claude/CLAUDE.md to use new sub-command structure - Add comprehensive CLI usage section to README.md with examples and options - Preserve all existing options and functionality without breaking changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1b49b04 commit 9f184f0

File tree

3 files changed

+78
-11
lines changed

3 files changed

+78
-11
lines changed

.claude/CLAUDE.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ make distclean
6969
### Running the CLI
7070
```bash
7171
# After installation, the CLI is available as:
72-
cedarmapper [PATH] [OPTIONS]
72+
cedarmapper ls [PATH] [OPTIONS]
7373

7474
# Examples:
75-
cedarmapper . # Flat output of current directory
76-
cedarmapper --tree # Tree output
77-
cedarmapper --max-depth 2 # Limit depth
78-
cedarmapper --sort -d # Sort by date descending
79-
cedarmapper --date day # Show dates as YYYY-MM-DD
80-
cedarmapper --skip-word-count # Skip word counting for speed
75+
cedarmapper ls . # Flat output of current directory
76+
cedarmapper ls --tree # Tree output
77+
cedarmapper ls --max-depth 2 # Limit depth
78+
cedarmapper ls --sort -d # Sort by date descending
79+
cedarmapper ls --date day # Show dates as YYYY-MM-DD
80+
cedarmapper ls --skip-word-count # Skip word counting for speed
8181
```
8282

8383
## Architecture

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,67 @@ pip install -e ".[dev]"
2222
pip install .
2323
```
2424

25+
## Usage
26+
27+
CedarMapper provides a sub-command interface for analyzing repository structure.
28+
29+
### Basic Usage
30+
31+
```bash
32+
cedarmapper ls [PATH] [OPTIONS]
33+
```
34+
35+
### Examples
36+
37+
```bash
38+
# Basic analysis of current directory
39+
cedarmapper ls .
40+
41+
# Tree view with human-friendly nesting
42+
cedarmapper ls . --tree
43+
44+
# Limit analysis depth
45+
cedarmapper ls --max-depth 2
46+
47+
# Sort by word count descending
48+
cedarmapper ls --sort -w
49+
50+
# Show dates in day format (YYYY-MM-DD)
51+
cedarmapper ls --date day
52+
53+
# Skip word counting for faster analysis
54+
cedarmapper ls --skip-word-count
55+
56+
# Follow symbolic links during traversal
57+
cedarmapper ls --follow-symlinks
58+
59+
# Combine multiple options
60+
cedarmapper ls src/ --tree --max-depth 3 --sort -s
61+
```
62+
63+
### Options
64+
65+
- `--max-depth, -d` - Display max depth: 0=root only, 1=root+children, etc.
66+
- `--tree` - Show tree-like nested output (human-friendly)
67+
- `--follow-symlinks` - Follow symbolic links during traversal
68+
- `--skip-word-count` - Skip word counting for speed
69+
- `--date` - Date display: 'seconds' (default), 'day', or 'none'
70+
- `--numbered-indent` - Show depth as number prefix (tree only)
71+
- `--sort` - Sort specification using keys: w=word count, s=size, d=date, i=depth, n=name, p=path
72+
73+
### Sort Examples
74+
75+
```bash
76+
# Sort by word count descending
77+
cedarmapper ls --sort -w
78+
79+
# Sort by size ascending, then name descending
80+
cedarmapper ls --sort "s-n"
81+
82+
# Complex sort: depth ascending, size descending, date ascending
83+
cedarmapper ls --sort "i-sd"
84+
```
85+
2586
## Development
2687

2788
### Setup

src/cedarmapper/cli/main.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,14 @@ def run_cli(argv: list[str] | None = None) -> tuple[int, str]:
8787
return 0, out
8888

8989

90-
@click.command()
91-
@click.argument("path", required=False, default=".")
90+
@click.group()
91+
def cli() -> None:
92+
"""CedarMapper - LLM Repository Analysis Tool"""
93+
pass
94+
95+
96+
@cli.command()
97+
@click.argument("path", default=".")
9298
@click.option(
9399
"--max-depth",
94100
"-d",
@@ -125,7 +131,7 @@ def run_cli(argv: list[str] | None = None) -> tuple[int, str]:
125131
default=None,
126132
help="Sort specification: a series of keys optionally prefixed with '-' for reverse. Keys: w=word count, s=size, d=date, i=depth, n=name, p=path. Examples: 'w', '-s', 'wi', 'i-sd'.",
127133
)
128-
def cli(
134+
def ls(
129135
path: str,
130136
max_depth: int,
131137
tree: bool,
@@ -135,7 +141,7 @@ def cli(
135141
numbered_indent: bool,
136142
sort_spec: str | None,
137143
) -> None:
138-
"""CLI entrypoint for cedarmapper."""
144+
"""List repository contents with analysis for LLM consumption."""
139145
argv = [path]
140146
if max_depth:
141147
argv.extend(["--max-depth", str(max_depth)])

0 commit comments

Comments
 (0)