fix: sync CLI flags across analyze/pdf/unified commands and fix workflow JSON config

Flag/option synchronization fixes:
- analyze: add --dry-run, --api-key, and all workflow flags (--enhance-workflow,
  --enhance-stage, --var, --workflow-dry-run) via WORKFLOW_ARGUMENTS merge
- pdf: add --api-key to PDF_ARGUMENTS; replace 5 hardcoded add_argument() calls
  in pdf_scraper.py:main() with add_pdf_arguments() to activate all defined args
- unified: add --api-key and --enhance-level (global override) to UNIFIED_ARGUMENTS
  and standalone parser; wire enhance_level CLI override into run() per-source loop
- codebase_scraper: fix --enhance-workflow to use action="append" (was type=str),
  enabling multiple workflow chaining instead of silently dropping all but last

ConfigManager test isolation fix:
- __init__ now reads self.CONFIG_DIR/CONFIG_FILE/PROGRESS_DIR class variables
  instead of calling _get_config_dir()/_get_progress_dir() directly, enabling
  monkeypatching in tests (fixes pre-existing test_add_and_retrieve_github_profile)

Workflow JSON config support in unified_scraper:
- Phase 5 now reads workflows/workflow_stages/workflow_vars from top-level JSON
  config and merges them with CLI args (CLI-first ordering); supports running
  workflows even when unified scraper is called without CLI args (args=None)

Tests: 1,949 passed, 0 failed (added 18 new tests across 3 test files)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-22 00:44:02 +03:00
parent 47226340ac
commit 22bdd4f5f6
10 changed files with 438 additions and 13 deletions

View File

@@ -519,5 +519,40 @@ class TestJSONWorkflow(unittest.TestCase):
self.assertEqual(converter.extracted_data["total_pages"], 1)
class TestPDFCLIArguments(unittest.TestCase):
"""Test PDF subcommand CLI argument parsing via the main CLI."""
def setUp(self):
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from skill_seekers.cli.main import create_parser
self.parser = create_parser()
def test_api_key_stored_correctly(self):
"""Test --api-key is accepted and stored correctly after switching to add_pdf_arguments."""
args = self.parser.parse_args(["pdf", "--pdf", "test.pdf", "--api-key", "sk-ant-test"])
self.assertEqual(args.api_key, "sk-ant-test")
def test_enhance_level_accepted(self):
"""Test --enhance-level is accepted for pdf subcommand."""
args = self.parser.parse_args(["pdf", "--pdf", "test.pdf", "--enhance-level", "1"])
self.assertEqual(args.enhance_level, 1)
def test_enhance_workflow_accepted(self):
"""Test --enhance-workflow is accepted and stores a list."""
args = self.parser.parse_args(
["pdf", "--pdf", "test.pdf", "--enhance-workflow", "minimal"]
)
self.assertEqual(args.enhance_workflow, ["minimal"])
def test_workflow_dry_run_accepted(self):
"""Test --workflow-dry-run is accepted."""
args = self.parser.parse_args(["pdf", "--pdf", "test.pdf", "--workflow-dry-run"])
self.assertTrue(args.workflow_dry_run)
if __name__ == "__main__":
unittest.main()