mix usage_rules.sync (usage_rules v0.1.24)

View Source

Combine 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.md can be included with ash:testing
  • deps/phoenix/usage-rules/views.md can 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)

Examples

Combine specific packages:

mix usage_rules.sync CLAUDE.md --all --link-to-folder deps

Gather all dependencies with usage rules:

mix usage_rules.sync CLAUDE.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 CLAUDE.md --list

Remove specific packages from a file:

mix usage_rules.sync CLAUDE.md ash phoenix --remove

Save usage rules to individual files in a folder with markdown links:

mix usage_rules.sync CLAUDE.md ash phoenix --link-to-folder rules

Save usage rules with @-style links:

mix usage_rules.sync CLAUDE.md ash phoenix --link-to-folder rules --link-style at

Link directly to deps files without copying:

mix usage_rules.sync CLAUDE.md ash phoenix --link-to-folder deps

Combine all dependencies with folder links:

mix usage_rules.sync CLAUDE.md --all --link-to-folder docs

Check status of packages using folder links:

mix usage_rules.sync CLAUDE.md --list --link-to-folder rules

Remove packages and their folder files:

mix usage_rules.sync CLAUDE.md ash phoenix --remove --link-to-folder rules

Include specific sub-rules:

mix usage_rules.sync CLAUDE.md ash:testing phoenix:views

Include all sub-rules from a package:

mix usage_rules.sync CLAUDE.md ash:all

Mix main package rules with sub-rules:

mix usage_rules.sync CLAUDE.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 CLAUDE.md ash:testing phoenix --inline ash:testing --link-to-folder docs

Remove unused packages that are no longer dependencies:

mix usage_rules.sync CLAUDE.md ash phoenix --remove-missing