Skip to content

refactor: Migrate AI CLI code to ai-cli-runner package #1

@myakove

Description

@myakove

Summary

Replace duplicated AI CLI integration code in src/docsfy/ai_client.py with imports from the new ai-cli-runner package.

What to Replace

Replace the entire contents of src/docsfy/ai_client.py:

  • call_ai_cli() function
  • check_ai_cli_available() function
  • ProviderConfig dataclass
  • PROVIDERS / PROVIDER_CONFIG dict
  • _build_claude_cmd, _build_gemini_cmd, _build_cursor_cmd functions
  • _get_ai_cli_timeout() function and AI_CLI_TIMEOUT constant
  • VALID_AI_PROVIDERS constant

Migration Notes

docsfy uses a 60-minute default timeout (vs 10 minutes for other projects). After migration, either:

  • Pass ai_cli_timeout=60 at each call site, or
  • Set AI_CLI_TIMEOUT=60 in the environment

Migration

  1. Add ai-cli-runner as a dependency in pyproject.toml
  2. Replace ai_client.py contents with re-exports or update imports:
    from ai_cli_runner import call_ai_cli, check_ai_cli_available
  3. Pass ai_cli_timeout=60 at call sites to preserve the 60-minute default
  4. Pass appropriate cli_flags at call sites
  5. Remove the old duplicated code

Blocked By

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions