k-skill/scripts/k_skill_cleaner.py
Jeffrey (Dongkyu) Kim 10cb419212 Align cleaner helper contract with selective installs
The cleanup helper is now shipped inside the k-skill-cleaner skill payload while the repo-root script remains as a compatibility wrapper. The CLI also enforces the interview-selected usage window with --days/--since and reports the effective cutoff so recommendations match the documented contract.\n\nConstraint: Selective skill installs only receive files under the skill directory.\nRejected: Remove k-skill-cleaner from selective install docs | the feature is intended to be installable standalone.\nConfidence: high\nScope-risk: narrow\nDirective: Keep the skill-local helper as the canonical implementation; the root script should stay a thin wrapper.\nTested: PYTHONPATH=scripts python3 -m unittest scripts.test_k_skill_cleaner\nTested: node --test scripts/skill-docs.test.js\nTested: CLI smoke via k-skill-cleaner/scripts/k_skill_cleaner.py with --days 90\nTested: npm run lint\nTested: npm run typecheck && npm test\nTested: npm run ci\nTested: Architect verification APPROVED\nNot-tested: Live agent transcript schemas beyond fixture-style local log samples
2026-04-28 17:50:54 +09:00

43 lines
1.5 KiB
Python
Executable file

#!/usr/bin/env python3
"""Compatibility wrapper for the k-skill-cleaner skill-local helper.
The standalone skill install includes ``k-skill-cleaner/scripts/k_skill_cleaner.py``.
This repository-root wrapper preserves existing checkout workflows and tests while
keeping the executable payload inside the skill directory.
"""
from __future__ import annotations
import importlib.util
from pathlib import Path
_HELPER_PATH = Path(__file__).resolve().parents[1] / "k-skill-cleaner" / "scripts" / "k_skill_cleaner.py"
_SPEC = importlib.util.spec_from_file_location("_k_skill_cleaner_impl", _HELPER_PATH)
if _SPEC is None or _SPEC.loader is None: # pragma: no cover - importlib defensive guard
raise ImportError(f"Unable to load k-skill-cleaner helper from {_HELPER_PATH}")
_MODULE = importlib.util.module_from_spec(_SPEC)
_SPEC.loader.exec_module(_MODULE)
AGENT_USAGE_SOURCES = _MODULE.AGENT_USAGE_SOURCES
collect_skill_usage = _MODULE.collect_skill_usage
find_skill_dirs = _MODULE.find_skill_dirs
rank_cleanup_candidates = _MODULE.rank_cleanup_candidates
load_usage_json = _MODULE.load_usage_json
expand_default_log_paths = _MODULE.expand_default_log_paths
parse_csv = _MODULE.parse_csv
build_parser = _MODULE.build_parser
main = _MODULE.main
__all__ = [
"AGENT_USAGE_SOURCES",
"collect_skill_usage",
"find_skill_dirs",
"rank_cleanup_candidates",
"load_usage_json",
"expand_default_log_paths",
"parse_csv",
"build_parser",
"main",
]
if __name__ == "__main__":
raise SystemExit(main())