fix: Fix 2 critical CLI issues blocking production (Kimi QA)

**Critical Issues Fixed:**

Issue #1: CLI Commands Were BROKEN ⚠️ CRITICAL
- Problem: 4 CLI commands existed but failed at runtime with ImportError
- Root Cause: Modules had example_usage() instead of main() functions
- Impact: Users couldn't use quality, stream, update, multilang features

**Fixed Files:**
- src/skill_seekers/cli/quality_metrics.py
  - Renamed example_usage() → main()
  - Added argparse with --report, --output flags
  - Proper exit codes and error handling

- src/skill_seekers/cli/streaming_ingest.py
  - Renamed example_usage() → main()
  - Added argparse with --chunk-size, --batch-size, --checkpoint flags
  - Supports both file and directory inputs

- src/skill_seekers/cli/incremental_updater.py
  - Renamed example_usage() → main()
  - Added argparse with --check-changes, --generate-package, --apply-update flags
  - Proper error handling and exit codes

- src/skill_seekers/cli/multilang_support.py
  - Renamed example_usage() → main()
  - Added argparse with --detect, --report, --export flags
  - Loads skill documents from directory

Issue #2: Haystack Missing from Package Choices ⚠️ CRITICAL
- Problem: Haystack adaptor worked but couldn't be used via CLI
- Root Cause: package_skill.py missing "haystack" in --target choices
- Impact: Users got "invalid choice" error when packaging for Haystack

**Fixed:**
- src/skill_seekers/cli/package_skill.py:188
  - Added "haystack" to --target choices list
  - Now matches main.py choices (all 11 platforms)

**Verification:**
 All 4 CLI commands now work:
   $ skill-seekers quality --help
   $ skill-seekers stream --help
   $ skill-seekers update --help
   $ skill-seekers multilang --help

 Haystack now available:
   $ skill-seekers package output/skill --target haystack

 All 164 adaptor tests still passing
 No regressions detected

**Credits:**
- Issues identified by: Kimi QA Review
- Fixes implemented by: Claude Sonnet 4.5

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-07 23:12:40 +03:00
parent 6f9584ba67
commit a332507b1d
5 changed files with 151 additions and 56 deletions

View File

@@ -397,40 +397,68 @@ class MultiLanguageManager:
return "\n".join(lines)
def example_usage():
"""Example usage of multi-language support."""
def main():
"""CLI entry point for multi-language support."""
import argparse
from pathlib import Path
parser = argparse.ArgumentParser(description="Manage multi-language skill documents")
parser.add_argument("skill_dir", help="Path to skill directory")
parser.add_argument("--detect", action="store_true", help="Detect languages in skill")
parser.add_argument("--report", action="store_true", help="Generate translation report")
parser.add_argument("--export", help="Export by language to specified directory")
args = parser.parse_args()
skill_dir = Path(args.skill_dir)
if not skill_dir.exists():
print(f"❌ Error: Directory not found: {skill_dir}")
return 1
manager = MultiLanguageManager()
# Add documents in different languages
manager.add_document(
"README.md",
"# Getting Started\n\nThis is an English document about the project.",
{"category": "overview"}
)
# Load skill documents
print("📥 Loading skill documents...")
skill_md = skill_dir / "SKILL.md"
if skill_md.exists():
manager.add_document(
"SKILL.md",
skill_md.read_text(encoding="utf-8"),
{"category": "overview"}
)
manager.add_document(
"README.es.md",
"# Empezando\n\nEste es un documento en español sobre el proyecto.",
{"category": "overview"}
)
# Load reference files
refs_dir = skill_dir / "references"
if refs_dir.exists():
for ref_file in refs_dir.glob("*.md"):
manager.add_document(
ref_file.name,
ref_file.read_text(encoding="utf-8"),
{"category": ref_file.stem}
)
manager.add_document(
"README.fr.md",
"# Commencer\n\nCeci est un document en français sur le projet.",
{"category": "overview"}
)
# Detect languages
if args.detect:
detected = manager.detect_languages()
print(f"\n🌍 Detected languages: {', '.join(detected.keys())}")
for lang, count in detected.items():
print(f" {lang}: {count} documents")
# Generate report
print(manager.generate_translation_report())
if args.report:
print(manager.generate_translation_report())
# Export by language
exports = manager.export_by_language(Path("output/multilang"))
print(f"\n✅ Exported {len(exports)} language files:")
for lang, path in exports.items():
print(f" {lang}: {path}")
if args.export:
output_dir = Path(args.export)
output_dir.mkdir(parents=True, exist_ok=True)
exports = manager.export_by_language(output_dir)
print(f"\n✅ Exported {len(exports)} language files:")
for lang, path in exports.items():
print(f" {lang}: {path}")
return 0
if __name__ == "__main__":
example_usage()
import sys
sys.exit(main())