Skip to content

pa1nrui1/enterprise-legal-ops / skills/enterprise-legal-ops

enterprise-legal-ops

Verified

中小企业本地法务运营管理 Skill。用于企业内部管理合同、员工/劳动合同/年假/制度、公章证照、章程权限、股东出资、提醒和本地自然语言问库。用户要初始化企业法务工作区、上传历史合同/员工花名册/劳动制度/证照/章程/授权/用印记录、生成本地台账、查询到期提醒、做企业内部合同审查 Word 修订稿、合同起草、HR 风险预判、制度冲突检查、旧制度合法性审查、公章用印权限校验、股东出资提醒、飞书日历提醒配置时触发。

FileKindSize
SKILL.mdskill md5.2 KB
agents/openai.yamlconfig330 B
references/contracts.mdmarkdown4.4 KB
references/hr.mdmarkdown5.5 KB
references/local-query.mdmarkdown2.5 KB
references/reminders.mdmarkdown2.8 KB
references/seals-licenses-governance.mdmarkdown5.3 KB
references/strict-review.mdmarkdown2.3 KB
references/workspace-data-standard.mdmarkdown2.7 KB
scripts/archive_record.pyscript19.7 KB
scripts/contract_redline_review.pyscript4.1 KB
scripts/import_document.pyexecutablescript11.3 KB
scripts/import_roster.pyscript11.9 KB
scripts/init_workspace.pyexecutablescript11.4 KB
scripts/ledger.pyexecutablescript7.4 KB
scripts/query_workspace.pyexecutablescript5.8 KB
scripts/reminders.pyexecutablescript20.9 KB
scripts/strict_review_record.pyscript5.3 KB
tests/test_enterprise_legal_ops.pyexecutablescript19.3 KB

scripts/contract_redline_review.py

View on GitHub
#!/usr/bin/env python3
"""Create an internal contract tracked-change review draft.

This is a thin wrapper around the existing legal contract review redline engine.
It keeps enterprise-legal-ops simple while preserving the proven DOCX redline path.
"""

from __future__ import annotations

import argparse
import os
import shutil
import subprocess
import sys
from pathlib import Path


def find_existing_engine(skill_dir: Path) -> tuple[Path, Path]:
    configured = os.environ.get("LEGAL_CONTRACT_REVIEW_SKILL", "").strip()
    if configured:
        legal_review = Path(configured).expanduser().resolve()
    else:
        skills_root = skill_dir.parent
        legal_review = skills_root / "legal" / "合同审查"
    apply_script = legal_review / "scripts" / "redline" / "apply_redline_plan.py"
    qa_script = legal_review / "scripts" / "redline" / "qa_redline.py"
    if not apply_script.exists():
        raise SystemExit(
            "missing redline engine. Set LEGAL_CONTRACT_REVIEW_SKILL to an existing "
            f"合同审查 Skill path, expected script: {apply_script}"
        )
    if not qa_script.exists():
        raise SystemExit(f"missing redline QA: {qa_script}")
    return apply_script, qa_script


def run(cmd: list[str]) -> None:
    proc = subprocess.run(cmd, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    if proc.returncode != 0:
        raise SystemExit(
            "command failed:\n"
            + " ".join(cmd)
            + "\nSTDOUT:\n"
            + proc.stdout
            + "\nSTDERR:\n"
            + proc.stderr
        )


def main() -> int:
    parser = argparse.ArgumentParser(description="Generate a contract tracked-change review draft.")
    parser.add_argument("--input", required=True, help="Original DOCX contract; preserved read-only.")
    parser.add_argument("--plan", required=True, help="redline-plan.json")
    parser.add_argument("--output", required=True, help="Output DOCX review draft.")
    parser.add_argument("--log", required=True, help="Execution log JSON.")
    parser.add_argument("--qa-report", required=True, help="QA report JSON.")
    parser.add_argument("--author", default="Enterprise Legal Ops")
    parser.add_argument("--organization", default="Internal Company Review")
    args = parser.parse_args()

    skill_dir = Path(__file__).resolve().parents[1]
    apply_script, qa_script = find_existing_engine(skill_dir)
    input_path = Path(args.input).expanduser().resolve()
    plan_path = Path(args.plan).expanduser().resolve()
    output_path = Path(args.output).expanduser().resolve()
    log_path = Path(args.log).expanduser().resolve()
    qa_path = Path(args.qa_report).expanduser().resolve()

    if not input_path.exists():
        raise SystemExit(f"input not found: {input_path}")
    if not plan_path.exists():
        raise SystemExit(f"plan not found: {plan_path}")
    output_path.parent.mkdir(parents=True, exist_ok=True)
    log_path.parent.mkdir(parents=True, exist_ok=True)
    qa_path.parent.mkdir(parents=True, exist_ok=True)

    # Guard against accidental overwrite of the original contract.
    if output_path == input_path:
        raise SystemExit("output must not be the same as input")
    backup = output_path.with_suffix(output_path.suffix + ".source-copy")
    if not backup.exists():
        shutil.copy2(input_path, backup)

    run([
        sys.executable, str(apply_script),
        "--input", str(input_path),
        "--plan", str(plan_path),
        "--output", str(output_path),
        "--log", str(log_path),
        "--author", args.author,
        "--organization", args.organization,
    ])
    run([
        sys.executable, str(qa_script),
        "--docx", str(output_path),
        "--report", str(qa_path),
    ])

    print("合同 Word 修订格式审核稿已生成。")
    print(f"原合同:{input_path}")
    print(f"审核修订稿:{output_path}")
    print(f"执行日志:{log_path}")
    print(f"QA 报告:{qa_path}")
    print("下一步:打开修订稿逐页检查,并确认所有需企业判断事项已用批注提示。")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 323kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 323kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 323kUpdated Claude CodeCodexVerifiedInstall