feat: Save new discussions in discussions/ subdirectory

When creating a discussion without an explicit output path, files are now
saved to discussions/ subdirectory instead of current directory. The
directory is created automatically if it doesn't exist.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rob 2026-01-07 16:55:40 -04:00
parent e1fb9d58ab
commit 8d8958ff79
1 changed files with 4 additions and 1 deletions

View File

@ -27,7 +27,10 @@ def cmd_new(args) -> int:
else: else:
slug = args.title.lower().replace(" ", "-") slug = args.title.lower().replace(" ", "-")
slug = "".join(c for c in slug if c.isalnum() or c == "-") slug = "".join(c for c in slug if c.isalnum() or c == "-")
path = Path(f"{slug}.discussion.md") path = Path("discussions") / f"{slug}.discussion.md"
# Ensure parent directory exists
path.parent.mkdir(parents=True, exist_ok=True)
if path.exists() and not args.force: if path.exists() and not args.force:
print(f"Error: {path} already exists. Use --force to overwrite.") print(f"Error: {path} already exists. Use --force to overwrite.")