Skip to content

Commit 7611517

Browse files
committed
fix: cleaner output -- relative paths, line count, better done message
- wrote AGENTS.md (49 lines) instead of full absolute path - 'Claude knows your project.' instead of bare 'done' - saar add no longer shows full .saar/config.json path - updated manual edits preserved message includes line count - cleaner demo GIF (196KB, no echo hacks, no comment lines)
1 parent df22f48 commit 7611517

3 files changed

Lines changed: 54 additions & 47 deletions

File tree

saar.tape

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,35 @@
1-
# saar.tape — full viral demo
2-
# To run: cd /tmp && vhs /Users/devanshu/Desktop/codeintel/saar/saar.tape
3-
41
Output saar_demo.gif
52

63
Set FontSize 14
7-
Set Width 980
8-
Set Height 560
4+
Set Width 1000
5+
Set Height 600
96
Set Theme "Catppuccin Mocha"
10-
Set TypingSpeed 50ms
11-
Set PlaybackSpeed 0.85
12-
Set Padding 24
7+
Set TypingSpeed 55ms
8+
Set PlaybackSpeed 0.82
9+
Set Padding 30
1310
Set MarginFill "#1e1e2e"
14-
Set BorderRadius 12
11+
Set BorderRadius 14
1512
Set WindowBar Colorful
16-
Set WindowBarSize 26
13+
Set WindowBarSize 28
1714

18-
Hide
19-
Type "export PATH='/Users/devanshu/.local/bin:/opt/homebrew/bin:$PATH'"
20-
Enter
21-
Type "cd /tmp/studymate-demo"
15+
# Scene 1: show the project -- clean start, no setup noise
16+
Type "ls"
2217
Enter
23-
Type "clear"
24-
Enter
25-
Show
26-
27-
# Scene 1 — show the project
28-
Type "ls backend/routes/"
29-
Enter
30-
Sleep 1000ms
18+
Sleep 1200ms
3119

32-
# Scene 2 — the one command
20+
# Scene 2: one command
3321
Type "saar extract . --no-interview"
3422
Enter
35-
Sleep 9500ms
23+
Sleep 11000ms
3624

37-
# Scene 3 — size check
38-
Type "wc -l AGENTS.md"
39-
Enter
40-
Sleep 800ms
41-
Type "echo '70 lines. Claude will read every single one.'"
25+
# Scene 3: add a correction
26+
Type "saar add 'Never use npm -- this project uses bun'"
4227
Enter
43-
Sleep 1200ms
44-
45-
# Scene 4 — add a rule instantly
46-
Type "saar add 'Never use npm — this project uses bun'"
47-
Enter
48-
Sleep 1200ms
28+
Sleep 2000ms
4929

50-
# Scene 5 — diff
51-
Type "saar diff ."
30+
# Scene 4: the score
31+
Type "saar stats ."
5232
Enter
53-
Sleep 3500ms
33+
Sleep 6000ms
5434

55-
Sleep 2000ms
35+
Sleep 3000ms

saar/cli.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ def add(
209209
append_to_cache(repo_path, field, correction)
210210
console.print(f" [green]added[/green] [{label}] {correction}")
211211
console.print(
212-
f" [dim]Saved to {repo_path / '.saar/config.json'}. "
213-
f"Re-run [bold]saar .[/bold] to regenerate context files.[/dim]"
212+
" [dim]Saved to .saar/config.json. "
213+
"Re-run [bold]saar .[/bold] to regenerate context files.[/dim]"
214214
)
215215

216216

@@ -419,7 +419,11 @@ def extract(
419419
if index:
420420
_run_oci_indexing(repo_path, console)
421421

422-
console.print("[bold green]done[/bold green]")
422+
console.print()
423+
console.print(
424+
" [bold green]Claude knows your project.[/bold green]"
425+
" [dim]Drop AGENTS.md in your repo root — it's picked up automatically.[/dim]"
426+
)
423427

424428

425429
def _show_detection_summary(dna, console, no_interview: bool) -> bool:
@@ -583,17 +587,33 @@ def _write_with_markers(
583587
"""
584588
wrapped = f"{_MARKER_START}\n{generated.rstrip()}\n{_MARKER_END}\n"
585589

590+
# Show relative path if inside cwd, otherwise just filename -- never full absolute path
591+
def _display_path(p: Path) -> str:
592+
try:
593+
return str(p.relative_to(Path.cwd()))
594+
except ValueError:
595+
return p.name
596+
597+
def _line_count(text: str) -> int:
598+
return len([ln for ln in text.splitlines() if ln.strip()])
599+
586600
if not target.exists():
587601
target.write_text(wrapped, encoding="utf-8")
588-
console.print(f" [green]wrote[/green] {target}")
602+
console.print(
603+
f" [green]wrote[/green] {_display_path(target)}"
604+
f" [dim]({_line_count(wrapped)} lines)[/dim]"
605+
)
589606
return
590607

591608
existing = target.read_text(encoding="utf-8")
592609

593610
if force:
594611
# full overwrite -- discard everything including manual edits
595612
target.write_text(wrapped, encoding="utf-8")
596-
console.print(f" [green]overwrote[/green] {target}")
613+
console.print(
614+
f" [green]wrote[/green] {_display_path(target)}"
615+
f" [dim]({_line_count(wrapped)} lines)[/dim]"
616+
)
597617
return
598618

599619
start_idx = existing.find(_MARKER_START)
@@ -603,7 +623,10 @@ def _write_with_markers(
603623
# No markers -- file exists but was written before markers were introduced
604624
# (or is purely hand-written). Treat it like first write: prepend auto block.
605625
target.write_text(wrapped + "\n" + existing, encoding="utf-8")
606-
console.print(f" [green]updated[/green] {target} (prepended auto block)")
626+
console.print(
627+
f" [green]updated[/green] {_display_path(target)}"
628+
f" [dim]({_line_count(wrapped + existing)} lines)[/dim]"
629+
)
607630
return
608631

609632
# Splice: keep everything before the start marker and after the end marker.
@@ -618,8 +641,12 @@ def _write_with_markers(
618641
# Strip any orphaned SAAR markers from the preserved manual section.
619642
after = after.replace(_MARKER_START, "").replace(_MARKER_END, "")
620643

621-
target.write_text(before + wrapped + after, encoding="utf-8")
622-
console.print(f" [green]updated[/green] {target} (preserved manual edits)")
644+
final = before + wrapped + after
645+
target.write_text(final, encoding="utf-8")
646+
console.print(
647+
f" [green]updated[/green] {_display_path(target)}"
648+
f" [dim]({_line_count(final)} lines, manual edits preserved)[/dim]"
649+
)
623650

624651

625652
def _run_oci_indexing(repo_path: Path, console) -> None:

saar_demo.gif

-99.7 KB
Loading

0 commit comments

Comments
 (0)