mix usage_rules.sync (usage_rules v0.1.25)
View SourceCombine the package rules for the provided packages into the provided file, or list/gather all dependencies.
Package Specifications
Packages can be specified in the following formats:
- package_name- Include the main usage-rules.md file for the package
- package_name:sub_rule- Include a specific sub-rule from the package's usage-rules/ folder
- package_name:all- Include all sub-rules from the package's usage-rules/ folder
Sub-rules are discovered from usage-rules/ folders within package directories. For example:
- deps/ash/usage-rules/testing.mdcan be included with- ash:testing
- deps/phoenix/usage-rules/views.mdcan be included with- phoenix:views
Options
- --all- Gather usage rules from all dependencies that have them (includes both main rules and all sub-rules)
- --list- List all dependencies with usage rules. If a file is provided, shows status (present, missing, stale)
- --remove- Remove specified packages from the target file instead of adding them
- --remove-missing- Remove any packages from the target file that are not listed in the command
- --link-to-folder <folder>- Save usage rules for each package in separate files within the specified folder and create links to them
- --link-style <style>- Style of links to create when using --link-to-folder (markdown|at). Defaults to 'markdown'
- --inline <specs>- Force specific packages to be inlined even when using --link-to-folder. Supports same specs as packages (comma-separated)
- --folder-only <folder>- Extract usage rules to the specified folder without updating any other files
- --merge-sub-rules- When used with --folder-only, merge sub-rules into the same file per package
Examples
Combine specific packages:
mix usage_rules.sync AGENTS.md --all --link-to-folder deps
Gather all dependencies with usage rules:
mix usage_rules.sync AGENTS.md --all
List all dependencies with usage rules:
mix usage_rules.sync --list
Check status of dependencies against a specific file:
mix usage_rules.sync AGENTS.md --list
Remove specific packages from a file:
mix usage_rules.sync AGENTS.md ash phoenix --remove
Save usage rules to individual files in a folder with markdown links:
mix usage_rules.sync AGENTS.md ash phoenix --link-to-folder rules
Save usage rules with @-style links:
mix usage_rules.sync AGENTS.md ash phoenix --link-to-folder rules --link-style at
Link directly to deps files without copying:
mix usage_rules.sync AGENTS.md ash phoenix --link-to-folder deps
Combine all dependencies with folder links:
mix usage_rules.sync AGENTS.md --all --link-to-folder docs
Check status of packages using folder links:
mix usage_rules.sync AGENTS.md --list --link-to-folder rules
Remove packages and their folder files:
mix usage_rules.sync AGENTS.md ash phoenix --remove --link-to-folder rules
Include specific sub-rules:
mix usage_rules.sync AGENTS.md ash:testing phoenix:views
Include all sub-rules from a package:
mix usage_rules.sync AGENTS.md ash:all
Mix main package rules with sub-rules:
mix usage_rules.sync AGENTS.md ash ash:testing phoenix:views
Inline all sub-rules while linking main packages (recommended for agents):
mix usage_rules.sync AGENTS.md --all --inline usage_rules:all --link-to-folder deps
Inline specific packages while linking others:
mix usage_rules.sync AGENTS.md ash:testing phoenix --inline ash:testing --link-to-folder docs
Remove unused packages that are no longer dependencies:
mix usage_rules.sync AGENTS.md ash phoenix --remove-missing
Extract usage rules to folder without updating any files:
mix usage_rules.sync ash phoenix --folder-only rules
Extract all usage rules to folder:
mix usage_rules.sync --all --folder-only docs
Extract sub-rules as separate files:
mix usage_rules.sync ash:testing ash:queries --folder-only rules
Extract and merge sub-rules into single files per package:
mix usage_rules.sync ash:testing ash:queries --folder-only rules --merge-sub-rules
Extract all usage rules with merging:
mix usage_rules.sync --all --folder-only docs --merge-sub-rules