This document explains how to use the JSON configuration file to control upstream repository synchronization and glob patterns.
The upstream.config.json file allows you to specify which GitHub repositories should be treated as upstream resources and control which files are synced using glob patterns on a per-repository basis.
Create an upstream.config.json file in the project root directory. This file is required - sync scripts will fail if the file doesn't exist or doesn't contain configuration for the repository being synced.
{
"repos": [
{
"name": "owner/repository-name",
"branch": "main",
"assets": {
"resourceType": {
"from": "source-path",
"to": "local-path"
}
}
}
]
}repos(array): List of upstream repository configurationsname(string): Repository identifier in formatowner/repository-namebranch(string): Git branch to sync from (typically "main")assets(object): Map of resource types to sync configurationsresourceType(object): Configuration for a specific asset type (e.g., "agents", "instructions", "skills")from(string): Source directory path in the upstream repositoryto(string): Target directory path in this repository
Note: Glob patterns are used internally by the sync scripts to match files within each resource type directory. The patterns are defined within the sync script logic based on the resource type (e.g., agents sync uses agents/**/*.md).
Standard glob syntax is supported via the minimatch library:
*- Matches any characters except/(within a path segment)**- Matches any characters including/(across path segments)?- Matches a single character[abc]- Matches any character in the set{a,b}- Matches eitheraorb
src/**- All files under thesrcdirectory*.md- All markdown files in the root directorydocs/**/*.md- All markdown files anywhere underdocsconfig/*.json- All JSON files directly in theconfigdirectory{src,lib}/**/*.js- All JavaScript files undersrcorlibagents/**/*.agent.md- All agent markdown files underagents
The actual configuration used by workspace-architect:
{
"repos": [
{
"name": "github/awesome-copilot",
"branch": "main",
"assets": {
"agents": {
"from": "agents",
"to": "assets/agents"
},
"instructions": {
"from": "instructions",
"to": "assets/instructions"
}
}
},
{
"name": "anthropics/skills",
"branch": "main",
"assets": {
"skills": {
"from": "skills",
"to": "assets/skills"
}
}
}
]
}Sync multiple asset types from a single repository:
{
"repos": [
{
"name": "github/awesome-copilot",
"branch": "main",
"assets": {
"agents": {
"from": "agents",
"to": "assets/agents"
},
"instructions": {
"from": "instructions",
"to": "assets/instructions"
},
"skills": {
"from": "skills",
"to": "assets/skills"
}
}
}
]
}The sync scripts require upstream.config.json in the project root:
npm run sync-agents
npm run sync-instructionsNote: As of the latest version, prompts are maintained locally in this repository and are not synced from upstream sources.
The config file must exist and contain configuration for the repository being synced. If the config file is missing or doesn't contain the repository configuration, the sync script will fail with an error.
- Config File Exists with Matching Repo: Sync scripts load the config and sync the specified asset types
- Config File Missing: Scripts fail with an error message indicating the config file is required
- No Matching Asset: Scripts fail with an error indicating no configuration was found for the resource type
When using sync patterns, the sync process will:
- Download files matching the patterns
- Delete local files that don't match the patterns (if they were previously synced)
- Only delete files tracked in the
.upstream-sync.jsonmetadata file
This ensures that manually created local files are never accidentally deleted.
To test your configuration:
- Create or modify
upstream.config.jsonwith your desired asset types - Run the relevant sync script (e.g.,
npm run sync-agents) - Check the output to see which files were synced
- Review the local directory to confirm the results
The sync output will show:
- Which config file was loaded
- Which repository and asset type is being synced
- Which files were downloaded
- Which files were deleted
The configuration file is completely optional. All existing sync scripts continue to work without it, maintaining full backward compatibility with existing workflows.
- Match Upstream Structure: Ensure
frompaths match the actual directory structure in upstream repositories - Test First: Test sync scripts with a single asset type before syncing all
- Version Control: Commit
upstream.config.jsonto share configuration with your team - Validate Structure: Ensure the JSON structure matches the schema exactly
If you see an error like Upstream config file not found, create an upstream.config.json file in the project root with the appropriate repository and asset configuration.
If you see an error like Unknown resource type: <type>, add the resource type to your upstream.config.json file under the appropriate repository's assets object.
- Check that the
frompath matches the actual directory path in the upstream repository - Verify that the upstream repository contains files in the specified directory
- Check that files have the expected extensions for that resource type
- Files are only deleted if they were previously synced (tracked in
.upstream-sync.json) - Manual local files are never deleted
- Review the asset configuration to ensure it matches your intended sync setup
Configure different asset types from different repositories:
{
"repos": [
{
"name": "github/awesome-copilot",
"branch": "main",
"assets": {
"agents": {
"from": "agents",
"to": "assets/agents"
},
"instructions": {
"from": "instructions",
"to": "assets/instructions"
}
}
},
{
"name": "anthropics/skills",
"branch": "main",
"assets": {
"skills": {
"from": "skills",
"to": "assets/skills"
}
}
}
]
}Each asset type has specific accepted file extensions:
- agents:
.agent.md,.md - instructions:
.instructions.md,.md - skills: Directory-based sync with
SKILL.mdand.pyfiles
upstream.config.json.example- Example configuration templatescripts/utils/config-loader.js- Configuration loading utilityscripts/utils/sync-base.js- Core sync logic with pattern supportscripts/utils/github-utils.js- GitHub API utilities with glob matching