Skip to content

MLE-30056: Add update copyright skill - #620

Open
vzhang-progress wants to merge 4 commits into
developfrom
MLE-30056-add-update-copyright-skill
Open

MLE-30056: Add update copyright skill#620
vzhang-progress wants to merge 4 commits into
developfrom
MLE-30056-add-update-copyright-skill

Conversation

@vzhang-progress

Copy link
Copy Markdown
Contributor

Summary

  • Add the update-copyright-headers Copilot skill for Java source files.
  • Provide deterministic copyright year detection based on each file’s Git history.
  • Document supported commands, exclusions, review confirmation, and update behavior.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new script has correctness/portability issues in exclusion matching, diff parsing, and tail usage that can lead to incorrect results or failures on BSD/macOS environments.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a new Copilot skill and supporting script to deterministically check/update Progress Software copyright headers in this repository, computing per-file end years from each file’s Git history.

Changes:

  • Add skill prompt/instructions for running a deterministic copyright header checker/updater.
  • Add a self-contained bash + git script to compute target years and apply header updates.
  • Add human-facing documentation for the skill and script usage/exclusions.
File summaries
File Description
.github/skills/update-copyright-headers/SKILL.md Skill definition and agent instructions/guardrails for running check/update flows.
.github/skills/update-copyright-headers/scripts/copyright_headers.sh Core deterministic checker/updater implementation (bash + git).
.github/skills/update-copyright-headers/README.md Human documentation for activation, exclusions, and direct script usage.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +234 to +239
if [[ "$pattern" == *'*'* ]]; then
regex="^${pattern//\*/.*}\$"
if [[ "$relpath" =~ $regex ]]; then
return 0
fi
fi
local diff_text="$1" line content
while IFS= read -r line || [[ -n "$line" ]]; do
case "$line" in
'+++'*|'---'*) continue ;;
Comment on lines +379 to +383
if [[ -n "$(tail -c1 -- "$path" 2>/dev/null)" ]]; then
FILE_HAS_TRAILING_NEWLINE=0
else
FILE_HAS_TRAILING_NEWLINE=1
fi
(( failed > 0 )) && exit 1
exit 0
else
(( count_needs > 0 || count_missing > 0 )) && exit 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count_error doesn't appear to be considered when choosing exit status. Is that intentional or does it need to be added?

abs="$resolved_dir/$base"
fi
relpath_from "$abs" "$repo_root"
RELPATHS+=("$RELPATH_RESULT")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's calling this one out to me, so it might be nitpicking, but the script doesn't seem to verify the relative path is in the repo. If the script is invoked on something like "/tmp/random-file.txt" outside the repo, the relative path could turn into "../../random-file.txt" and the script will still proceed to rewrite it. That might give an agent too much flexibility to invoke the script on out-of-scope files and be a bit of a risk it will modify things it shouldn't be touching.

if (( i == n-1 )) && (( FILE_HAS_TRAILING_NEWLINE == 0 )); then
printf '%s' "${FILE_LINES[$i]}"
else
printf '%s\n' "${FILE_LINES[$i]}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a missing header may create mixed line endings in a CRLF file. Existing lines retain their \r, but the newly generated header lines do not have one, and write_file_lines appends only \n. Since I don’t see a .gitattributes rule enforcing LF for Java files, should the script detect and preserve the file’s existing line-ending style?

@vzhang-progress vzhang-progress added this to the 12.2.0 milestone Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants