Skip to content

Conversation

@gn00295120
Copy link

Summary

  • Add input validation for duplicate issue numbers in auto-close-duplicates.ts

    • Prevents referencing issues with numbers >= current issue (impossible duplicates)
    • Adds reasonable upper bound validation (< 1,000,000)
  • Use jq for safe JSON construction in log-issue-events.yml

    • Properly escapes special characters (newlines, quotes, backslashes)
    • Prevents malformed JSON payloads when issue titles contain special characters
  • Add missing plugin.json for plugin-dev plugin

    • Only plugin without configuration file (13 others have it)

Test plan

  • Verify auto-close-duplicates.ts compiles: bun build scripts/auto-close-duplicates.ts
  • Test JSON escaping with special characters:
    ISSUE_TITLE=$'line1\nline2 "quotes"'
    jq -n --arg title "$ISSUE_TITLE" '{title: $title}'
  • Verify plugin.json is valid JSON: jq . plugins/plugin-dev/.claude-plugin/plugin.json

Files Changed

File Change
scripts/auto-close-duplicates.ts Add issue number validation
.github/workflows/log-issue-events.yml Use jq for safe JSON
plugins/plugin-dev/.claude-plugin/plugin.json New file

🤖 Generated with Claude Code

Scripts:
- Add validation for extracted duplicate issue numbers
- Prevent referencing non-existent issues (number >= current issue)

Workflows:
- Use jq for safe JSON construction in log-issue-events.yml
- Properly escape special characters (newlines, quotes) in issue titles

Plugins:
- Add missing plugin.json for plugin-dev plugin

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 9, 2026 06:47
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request enhances input validation and JSON safety across three files: adding duplicate issue number validation in the auto-close script, improving JSON construction in a GitHub workflow, and adding a missing plugin configuration file.

  • Input validation prevents referencing non-existent or future issue numbers
  • JSON construction now uses jq for proper escaping of special characters
  • Added missing plugin.json for the plugin-dev plugin

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
scripts/auto-close-duplicates.ts Adds validation to ensure duplicate issue references are valid (positive, less than current issue, reasonable upper bound)
.github/workflows/log-issue-events.yml Replaces manual JSON string construction with jq for safe character escaping
plugins/plugin-dev/.claude-plugin/plugin.json New configuration file with metadata for the plugin-dev plugin

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 53 to 67
const num = parseInt(match[1], 10);
// Validate: must be positive, less than current issue, and reasonable
if (num > 0 && num < currentIssueNumber && num < 1000000) {
return num;
}
}

// Try to match GitHub issue URL format: https://github.com/owner/repo/issues/123
match = commentBody.match(/github\.com\/[^\/]+\/[^\/]+\/issues\/(\d+)/);
if (match) {
return parseInt(match[1], 10);
const num = parseInt(match[1], 10);
// Validate: must be positive, less than current issue, and reasonable
if (num > 0 && num < currentIssueNumber && num < 1000000) {
return num;
}
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The validation logic is duplicated in both pattern matching branches. Consider extracting this into a helper function or performing the validation after both pattern matches. This would make the code more maintainable and reduce the risk of the validation logic diverging between the two branches.

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 8
{
"name": "plugin-dev",
"version": "1.0.0",
"description": "Comprehensive toolkit for developing Claude Code plugins with expert guidance on hooks, MCP integration, plugin structure, and marketplace publishing",
"author": {
"name": "Anthropic",
"email": "support@anthropic.com"
}
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The field order in this plugin.json file differs from other plugin.json files in the repository. Other plugins use the order: name, description, version, author. This file uses: name, version, description, author. Consider reordering the fields to match the existing convention for consistency.

Copilot uses AI. Check for mistakes.
- Extract validation logic to isValidDuplicateIssueNumber helper function
- Reorder plugin.json fields to match convention (name, description, version, author)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant