Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

User description

Scaffolded projects now include .changeset/config.json with the repository field populated from the interactive projectRepository prompt.

Changes

  • Template: Added .changeset/config.json with standard changeset configuration using @changesets/changelog-github

  • Template function: Added changesetRepo() helper to extract owner/repo from GitHub URLs

    • Handles URLs with/without .git extension, trailing slashes, and query parameters
    • Regex: /github\.com\/([^/]+\/[^/.?#]+)/
    • Input validation for null/undefined/non-string values
  • Template integration: Uses SAO templating to populate repo field dynamically:

    {
      "changelog": [
        "@changesets/changelog-github",
        {
          "repo": "<%- changesetRepo({ projectRepository }) %>"
        }
      ]
    }

Example

When scaffolding with projectRepository: "https://github.com/user/my-lib":

{
  "$schema": "https://unpkg.com/@changesets/config/schema.json",
  "changelog": ["@changesets/changelog-github", { "repo": "user/my-lib" }],
  "commit": false,
  "access": "public",
  "baseBranch": "main",
  "updateInternalDependencies": "patch"
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature - add default changeset setup to the template</issue_title>
<issue_description>Let's update the template to also include the following kind of configuration for the changeset in the created scaffolded package:

There should be a .changeset/ directory in the template, it should include the following config.json file:

{
  "$schema": "https://unpkg.com/@changesets/config/schema.json",
  "changelog": [
    "@changesets/changelog-github",
    {
      "repo": ""
    }
  ],
  "commit": false,
  "fixed": [],
  "linked": [],
  "access": "public",
  "baseBranch": "main",
  "updateInternalDependencies": "patch",
  "ignore": []
}

IMPORTANT: the repo entry in the config.json shouldn't be left empty, it should be set to the repo from the interactive sao prompts.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


PR Type

Enhancement


Description

  • Add .changeset/config.json template with dynamic repository configuration

  • Implement changesetRepo() helper function to extract owner/repo from GitHub URLs

  • Add comprehensive test coverage for changeset config generation and URL parsing

  • Support various GitHub URL formats (.git, trailing slashes, query parameters)


Diagram Walkthrough

flowchart LR
  A["SAO Template"] -->|"prompts projectRepository"| B["changesetRepo Helper"]
  B -->|"extracts owner/repo"| C[".changeset/config.json"]
  C -->|"populated with repo"| D["Scaffolded Project"]
Loading

File Walkthrough

Relevant files
Enhancement
saofile.js
Add changesetRepo helper function                                               

saofile.js

  • Added changesetRepo() template function to extract owner/repo from
    GitHub URLs
  • Validates input for null/undefined/non-string values
  • Uses regex pattern to handle URLs with/without .git extension and
    trailing slashes
+7/-0     
config.json
Create changeset config template file                                       

template/.changeset/config.json

  • Created new changeset configuration file with standard settings
  • Dynamically populates repo field using SAO templating syntax
  • Includes schema reference, GitHub changelog plugin, and default
    configuration options
+16/-0   
Tests
generator.test.js
Add changeset config generation tests                                       

tests/generator.test.js

  • Added test to verify .changeset/config.json file creation
  • Added test for correct repo extraction from standard GitHub URLs
  • Added test for .git extension handling in URLs
  • Added tests for trailing slash handling and empty projectRepository
    gracefully
+62/-0   

Copilot AI and others added 2 commits January 23, 2026 17:33
Co-authored-by: lirantal <316371+lirantal@users.noreply.github.com>
Co-authored-by: lirantal <316371+lirantal@users.noreply.github.com>
Copilot AI changed the title [WIP] Add default changeset setup to the template Add default changeset configuration to scaffolded projects Jan 23, 2026
Copilot AI requested a review from lirantal January 23, 2026 17:37
@lirantal lirantal marked this pull request as ready for review January 23, 2026 18:44
@lirantal lirantal merged commit 2cc16c6 into main Jan 23, 2026
7 checks passed
@lirantal lirantal deleted the copilot/add-default-changeset-setup branch January 23, 2026 18:45
@qodo-code-review
Copy link

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟢
🎫 #39
🟢 Add a .changeset/ directory to the template containing a config.json file with the
specified Changesets configuration (schema, changelog-github, commit false, access public,
baseBranch main, updateInternalDependencies patch, and empty arrays for
fixed/linked/ignore).
Ensure the changelog[1].repo entry in .changeset/config.json is not left empty by default
and is populated from the interactive SAO prompt value for the repository
(projectRepository), in owner/repo format.
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

🔴
Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Template injection risk: The template uses unescaped output (<%- ... %>) to insert projectRepository-derived
data into JSON without strict sanitization, allowing malformed or injected content if a
user supplies a crafted repository string.

Referred Code
  "repo": "<%- changesetRepo({ projectRepository }) %>"
}

Learn more about managing compliance generic rules or creating your own custom rules

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

github-actions bot pushed a commit that referenced this pull request Jan 23, 2026
## [2.9.4](v2.9.3...v2.9.4) (2026-01-23)

### Bug Fixes

* add default changeset configuration to scaffolded projects ([#41](#41)) ([2cc16c6](2cc16c6))
@github-actions
Copy link

🎉 This PR is included in version 2.9.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@qodo-code-review
Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix regex for repository URL parsing

Improve the repository URL parsing regex to correctly handle repository names
that include dots. The current regex truncates such names.

saofile.js [17-18]

-const match = projectRepository.match(/github\.com\/([^/]+\/[^/.?#]+)/)
-return match ? match[1] : ''
+const match = projectRepository.match(/github\.com\/([^/?#]+)/)
+if (!match) return ''
 
+// Remove trailing .git and/or slash
+return match[1].replace(/\.git$/, '').replace(/\/$/, '')
+
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a bug in the regex that fails to parse repository names containing dots, and provides a more robust regex-based solution that fixes the issue.

Medium
  • More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature - add default changeset setup to the template

2 participants