feat: Add rulesync fetch command to fetch configurations from GitHub#924
Merged
dyoshikawa merged 5 commits intomainfrom Feb 4, 2026
Merged
feat: Add rulesync fetch command to fetch configurations from GitHub#924dyoshikawa merged 5 commits intomainfrom
dyoshikawa merged 5 commits intomainfrom
Conversation
Add a new `rulesync fetch` command that allows fetching rulesync configuration files directly from GitHub repositories. This enables teams to share and reuse rulesync configurations across projects. Features: - Fetch from public and private GitHub repositories - Support multiple source formats (URL, owner/repo, owner/repo@ref:path) - Filter by features (rules, commands, subagents, skills, ignore, mcp, hooks) - Conflict resolution strategies (skip, overwrite) - Dry-run mode for previewing changes - Authentication via --token, GITHUB_TOKEN, or GH_TOKEN Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract buildContentsUrl helper to eliminate code duplication (DRY) - Add HTTPS validation for custom base URLs to prevent token exposure - Add path traversal protection using checkPathTraversal - Add file size limit check during fetch (10MB max) - Add validation for empty ref/path after delimiters - Add comprehensive tests for security measures - Remove duplicate try-catch wrapper in CLI (handled in fetchCommand) - Improve formatFetchSummary output format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Extract MAX_FILE_SIZE constant to shared rulesync-paths.ts (DRY violation) - Add path traversal validation for --output directory option (security) - Add URL encoding for owner/repo in GitHub API calls (security) - Remove unused validateRef method and its tests - Add RULESYNC_MCP_FILE_NAME and RULESYNC_HOOKS_FILE_NAME constants - Add comprehensive fetch command documentation to README.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace template literal string concatenation with the URL API for safer and more maintainable URL construction. Add buildRepoUrl helper method that uses new URL() for proper URL handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace manual fetch API calls with the official GitHub SDK (@octokit/rest) for safer, more maintainable API interactions: - Use Octokit for all GitHub API calls - Automatic URL construction and encoding handled by SDK - Better error handling with RequestError - Consistent authentication management Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rulesync fetchcommand to fetch rulesync configuration files directly from GitHub repositoriesSecurity Measures
checkPathTraversal()for both file paths and output directoryCode Quality Improvements
MAX_FILE_SIZEconstant to sharedrulesync-paths.ts(eliminates duplication)RULESYNC_MCP_FILE_NAMEandRULESYNC_HOOKS_FILE_NAMEconstants for consistencyvalidateRefmethod from GitHubClientTest plan
pnpm cicheck:codepasses🤖 Generated with Claude Code