@filesync/mirrors
v0.0.2
Published
Sync one file to multiple destinations.
Readme
@filesync/mirrors
Sync one file to multiple destinations.
Installation
npm install @filesync/mirrorsCLI Usage
# Sync files based on config
npx @filesync/mirrors
# Check if files are in sync (for CI)
npx @filesync/mirrors --check
# Dry run (report changes without writing)
npx @filesync/mirrors --dry-run
# List discovered source files
npx @filesync/mirrors --list
# Quiet mode (only print errors)
npx @filesync/mirrors --quiet
# Use an explicit config path
npx @filesync/mirrors --config path/to/filesync.config.jsonConfiguration
Create filesync.config.json in your project root:
{
"mirrors": [
{
"source": "**/README.ai.md",
"targets": ["AGENTS.md", ".github/copilot-instructions.md"]
}
]
}Configuration Options
- source: Glob pattern to find source files
- targets: Array of relative paths for mirror destinations (relative to each source file's directory)
Config Resolution
- If
--configis not provided, the CLI searches forfilesync.config.jsonfrom the invocation directory upward. - Syncing is always scoped to the invocation directory and below, even if the config file is found higher up.
- If no config is found, the CLI exits with a non-zero status and prints an error.
Programmatic API
import { syncMirrors } from "@filesync/mirrors";
const results = await syncMirrors({
config: {
mirrors: [
{
source: "**/README.ai.md",
targets: ["AGENTS.md"],
},
],
},
dryRun: false,
});Exit Codes
0: Success (or no changes in--checkmode)1: Files out of sync (in--checkmode)
