Skip to content

anbeime/skill / skills/legal-assistant-skills-main/contract-review

contract-review

Verified

律师助理与法律助手、项目管理专家在审核合同、排查条款风险时必备。自动执行基础、商业、法律三层审查,仅添加批注不改原文,一键生成带批注合同、审查摘要、综合意见及业务流程图,让合同风控与业务梳理更高效专业。

scripts/ooxml/validate.py

View on GitHub
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Run lightweight validation on unpacked Office documents."""

from __future__ import annotations

import argparse
from pathlib import Path
import sys

from validation import DOCXSchemaValidator, PPTXSchemaValidator, RedliningValidator


def _validators_for(ext: str):
    if ext == ".docx":
        return [DOCXSchemaValidator, RedliningValidator]
    if ext == ".pptx":
        return [PPTXSchemaValidator]
    return None


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description="Validate unpacked Office XML")
    parser.add_argument("unpacked_dir", help="Unpacked directory path")
    parser.add_argument("--original", required=True, help="Original file (.docx/.pptx/.xlsx)")
    parser.add_argument("-v", "--verbose", action="store_true", help="Verbose output")
    args = parser.parse_args(argv)

    unpacked_dir = Path(args.unpacked_dir)
    original_file = Path(args.original)

    if not unpacked_dir.is_dir():
        print(f"Error: {unpacked_dir} is not a directory")
        return 1
    if not original_file.is_file():
        print(f"Error: {original_file} is not a file")
        return 1

    validators = _validators_for(original_file.suffix.lower())
    if not validators:
        print(f"Error: validation not supported for {original_file.suffix}")
        return 1

    success = True
    for validator_cls in validators:
        validator = validator_cls(unpacked_dir, original_file, verbose=args.verbose)
        if not validator.validate():
            success = False

    if success:
        print("Validation completed successfully.")
    return 0 if success else 1


if __name__ == "__main__":
    sys.exit(main())
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall