diff --git a/.github/workflows/license-header-fix.yml b/.github/workflows/license-header-fix.yml index ac94cb4f..cc7d510a 100644 --- a/.github/workflows/license-header-fix.yml +++ b/.github/workflows/license-header-fix.yml @@ -1,3 +1,6 @@ +# Copyright (c) 2025-2026 GeWuYou +# SPDX-License-Identifier: Apache-2.0 + # 维护者手动触发的 Apache-2.0 文件头修复流程。 name: License Header Fix diff --git a/AGENTS.md b/AGENTS.md index 06610a00..630282bd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -79,6 +79,23 @@ All AI agents and contributors must follow these rules when writing, reviewing, - The branch naming rule for a new task branch is `/`, where `` should match the intended Conventional Commit category as closely as practical. +## License Header Rules + +- Repository-maintained source and configuration files that are supported by `scripts/license-header.py` MUST include an + Apache-2.0 file header before the task is considered complete. +- When creating or modifying supported files, contributors MUST preserve an existing compliant header or add the SPDX + header generated by `python3 scripts/license-header.py --fix`. +- Before committing changes that add or modify supported source/configuration files, contributors MUST run + `python3 scripts/license-header.py --check` and resolve any missing or misplaced headers. +- For files with shebang lines, keep the shebang as the first line and place the license header immediately after it. +- For XML/MSBuild files with an XML declaration, keep the XML declaration as the first node and place the license header + immediately after it. +- Do not add project license headers to excluded or third-party areas such as `.agents/**`, `ai-libs/**`, + `third-party-licenses/**`, generated snapshots, binary assets, lock files, and generated build output. Treat + `scripts/license-header.py` as the authoritative include/exclude policy for this check. +- If CI reports a license-header failure, either fix it locally with `python3 scripts/license-header.py --fix` or, for + maintainer-owned cleanup, use the manual `License Header Fix` GitHub Actions workflow to create a reviewed repair PR. + ## Repository Boot Skill - The repository-maintained Codex boot skill lives at `.codex/skills/gframework-boot/`. diff --git a/scripts/license-header.py b/scripts/license-header.py index 5b060be5..d4374859 100644 --- a/scripts/license-header.py +++ b/scripts/license-header.py @@ -1,4 +1,7 @@ #!/usr/bin/env python3 +# Copyright (c) 2025-2026 GeWuYou +# SPDX-License-Identifier: Apache-2.0 + """Command entry point for repository license header checks.""" from __future__ import annotations