Skip to content

Add demo directory creation and content generation functions#30

Open
behrrad wants to merge 1 commit into
mainfrom
create-demo-directory
Open

Add demo directory creation and content generation functions#30
behrrad wants to merge 1 commit into
mainfrom
create-demo-directory

Conversation

@behrrad
Copy link
Copy Markdown
Contributor

@behrrad behrrad commented May 21, 2025

This pull request introduces a mechanism to copy demo files to the user's current working directory, improving usability and flexibility for running examples. It also includes a minor import addition for file operations. Below are the key changes:

Enhancements to demo file handling:

  • Replaced hardcoded demo entrypoint logic with functionality to copy the demo files (aiai_demo) to the user's current working directory. If the directory already exists, it uses the existing files; if copying fails, it falls back to the packaged version. This improves user experience by making the demo setup more intuitive and resilient.

Minor additions:

  • Added the shutil module import to support file operations for copying the demo directory.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aiai-cli-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2025 11:13pm

Introduce functionality to copy demo files to the user's current working directory if they don't already exist. Implement content generation methods, including `create_outline()` and `expand_to_content()`, utilizing the OpenAI API for improved content creation based on provided topics.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the handling of demo files by introducing logic to copy a demo directory to the user’s current working directory with a fallback mechanism. It replaces the previous hardcoded demo entrypoint logic and adds an import for file operations using shutil.

  • Implements copying of demo files from a packaged source to the current working directory.
  • Falls back to using the packaged demo if copying fails.
  • Adds the necessary import for file operations.

Comment thread aiai/main.py
f"📁 Using existing demo directory at {target_examples_dir}",
fg=typer.colors.YELLOW,
)
except Exception as exc: # noqa: BLE001 – non-critical failure
Copy link

Copilot AI May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider catching more specific exceptions (e.g. shutil.Error) instead of a generic Exception to narrow down error handling and avoid potentially masking unexpected errors.

Suggested change
except Exception as exc: # noqa: BLE001 – non-critical failure
except (FileNotFoundError, PermissionError, shutil.Error) as exc: # noqa: BLE001 – non-critical failure

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@ammirsm ammirsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants