Bidirectional mapping between local filesystem paths and published internet URLs for Augment AI workflows.
Version 2.0.0-alpha.1 - Planning release for enhanced CLI with comprehensive help system, advanced features, and utility commands
β οΈ Note: v2.0.0 features are documented but not yet implemented. This is a planning/specification release. Seeopenspec/cli-enhancement/for complete specifications andbead-tasks-cli-enhancement.mdfor implementation tasks.
Eliminate broken local-file links in AI-generated content when publishing to the web. This package provides a clean, reusable solution for mapping local development paths to published URLs, specifically designed for:
- Augment AI workflows
- OpenSpec spec-driven development
- Beads issue tracking integration
- WordPress publishing
- Static site generation
npm install @mytechtoday/url-referencenpx url-ref-mapper initThis creates a url-references.json file with seed data for 4 copper mining blog posts.
import { UrlReferenceMapper } from '@mytechtoday/url-reference';
const mapper = new UrlReferenceMapper({
configPath: './url-references.json'
});
// Get published URL from local path
// Windows
const url = mapper.getUrlFromLocalPath("C:\\projects\\blog\\post.html");
// macOS/Linux
const url = mapper.getUrlFromLocalPath("/home/user/projects/blog/post.html");
// β "https://mytech.today/published-url/"
// Reverse lookup
const path = mapper.getLocalPathFromUrl("https://mytech.today/published-url/");
// β "C:\\projects\\blog\\post.html" (Windows)
// β "/home/user/projects/blog/post.html" (macOS/Linux)
// Add new mapping
mapper.addMapping({
title: "New Blog Post",
url: "https://mytech.today/new-post/",
localPath: "C:\\projects\\blog\\new-post.html" // Windows
// localPath: "/home/user/projects/blog/new-post.html" // macOS/Linux
});
mapper.save();new UrlReferenceMapper(config?: UrlReferenceMapperConfig)Config Options:
configPath?: string- Path to JSON/YAML configuration filemappings?: UrlMapping[]- Inline mappings for testingautoSave?: boolean- Auto-save changes to config file (default: false)
Get published URL from local filesystem path.
Get local filesystem path from published URL.
Add a new URL-to-path mapping. Throws error if URL or path already exists.
Update an existing mapping by URL.
Remove a mapping by URL. Returns true if removed.
Get all mappings as an array.
Save mappings to file (JSON or YAML based on extension).
Validate all mappings. Returns errors and warnings.
Export mappings to JSON, YAML, or CSV format.
interface UrlMapping {
title: string;
url: string;
localPath: string;
lastUpdated?: string;
}
interface ValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
}
type ExportFormat = 'json' | 'yaml' | 'csv';Every command supports --help or -h for detailed usage information:
# Global help - list all commands
npx url-ref-mapper --help
npx url-ref-mapper -h
# Command-specific help
npx url-ref-mapper init --help
npx url-ref-mapper add -h
npx url-ref-mapper doctor --helpCreate a default configuration file with seed data.
npx url-ref-mapper init
npx url-ref-mapper init --format yaml --path custom-path.yaml
npx url-ref-mapper init --help # Show detailed helpAdd a new mapping.
Windows:
npx url-ref-mapper add ^
--title "My Blog Post" ^
--url "https://example.com/post/" ^
--path "C:\projects\blog\post.html"macOS/Linux:
npx url-ref-mapper add \
--title "My Blog Post" \
--url "https://example.com/post/" \
--path "/home/user/projects/blog/post.html"Remove a mapping by URL.
npx url-ref-mapper remove "https://example.com/post/"
npx url-ref-mapper remove --url "https://example.com/post/"List all mappings.
# Default text output
npx url-ref-mapper list
# JSON output
npx url-ref-mapper list --json
# Table format
npx url-ref-mapper list --format table
# Verbose output
npx url-ref-mapper list --verbose
# Quiet output (minimal)
npx url-ref-mapper list --quietGet published URL from local path.
Windows:
npx url-ref-mapper get-url "C:\projects\blog\post.html"
npx url-ref-mapper get-url "C:\projects\blog\post.html" --jsonmacOS/Linux:
npx url-ref-mapper get-url "/home/user/projects/blog/post.html"
npx url-ref-mapper get-url "/home/user/projects/blog/post.html" --jsonGet local path from published URL.
npx url-ref-mapper get-path "https://example.com/post/"
npx url-ref-mapper get-path "https://example.com/post/" --jsonValidate all mappings.
npx url-ref-mapper validate
npx url-ref-mapper validate --json
npx url-ref-mapper validate --verboseExport mappings to different formats.
npx url-ref-mapper export --format csv --output mappings.csv
npx url-ref-mapper export --format yaml
npx url-ref-mapper export --format json --output mappings.jsonStart an interactive REPL session for executing multiple commands.
npx url-ref-mapper interactive
# In interactive mode:
url-ref> add --title "Post" --url "https://example.com/post/" --path "/path/to/post.html"
url-ref> list
url-ref> validate
url-ref> exitFeatures:
- Command history (up/down arrows)
- Tab completion for commands and options
- History search (Ctrl+R)
- Persistent command history
Execute multiple commands from a file or stdin.
# From file
npx url-ref-mapper batch --file commands.txt
# From stdin
echo "list\nvalidate" | npx url-ref-mapper batch
# Stop on first error
npx url-ref-mapper batch --file commands.txt --stop-on-error
# Parallel execution
npx url-ref-mapper batch --file commands.txt --parallelInstall shell tab completion for faster command entry.
# Install for your shell
npx url-ref-mapper completion install
# Install for specific shell
npx url-ref-mapper completion install --shell bash
npx url-ref-mapper completion install --shell zsh
npx url-ref-mapper completion install --shell fish
# Uninstall completion
npx url-ref-mapper completion uninstallAll commands support multiple output formats:
# JSON output (machine-readable)
npx url-ref-mapper list --json
# YAML output
npx url-ref-mapper list --format yaml
# Table format
npx url-ref-mapper list --format table
# Verbose mode (detailed output)
npx url-ref-mapper validate --verbose
# Quiet mode (minimal output)
npx url-ref-mapper validate --quiet
# Disable colors
npx url-ref-mapper list --no-colorDisplay version information.
npx url-ref-mapper version
npx url-ref-mapper --version
npx url-ref-mapper version --jsonDisplay license information.
npx url-ref-mapper license
npx url-ref-mapper license --jsonShow contributors and dependencies.
npx url-ref-mapper credits
npx url-ref-mapper credits --jsonDisplay sponsorship information.
npx url-ref-mapper sponsorShow donation options.
npx url-ref-mapper donateDiagnose and fix common issues.
# Run all diagnostic checks
npx url-ref-mapper doctor
# Auto-fix issues
npx url-ref-mapper doctor --fix
# JSON output
npx url-ref-mapper doctor --json
# Verbose output
npx url-ref-mapper doctor --verboseDiagnostic Checks:
- Configuration file validation
- Node.js version compatibility
- Dependency verification
- File path validation
- URL accessibility
- File permissions
- Disk space availability
Safely uninstall the package.
# Interactive uninstall with confirmation
npx url-ref-mapper uninstall
# Uninstall without confirmation
npx url-ref-mapper uninstall --yes
# Uninstall global installation
npx url-ref-mapper uninstall --global --yes
# Keep configuration files
npx url-ref-mapper uninstall --keep-config- Every command has
--helpand-hoptions - Detailed usage, examples, and exit codes
- Global help lists all available commands
- Interactive Mode - REPL-style command execution with history and tab completion
- Batch Mode - Execute multiple commands from file or stdin
- Tab Completion - Shell completion for bash, zsh, and fish
- Output Formatting - JSON, YAML, table, and text formats
- Verbose/Quiet Modes - Control output verbosity
- Colored Output - Enhanced readability with automatic TTY detection
- version - Display version and system information
- license - Show license information
- credits - List contributors and dependencies
- sponsor - Display sponsorship options
- donate - Show donation information
- doctor - Diagnose and auto-fix common issues
- uninstall - Safely remove the package
- 100% test coverage
- Cross-platform compatibility (Windows, macOS, Linux)
- Performance optimizations
- Comprehensive error handling
This package is designed to work seamlessly with Augment AI workflows:
All functionality is accessible through CLI commands, making it perfect for AI agents:
# AI can discover all commands
npx url-ref-mapper --help
# AI can get help for any command
npx url-ref-mapper add --help
# AI can diagnose issues
npx url-ref-mapper doctor
# AI can use JSON output for parsing
npx url-ref-mapper list --jsonReference the package in your spec files:
Use @mytechtoday/url-reference to resolve local paths to published URLs.# Create a task that uses the mapper
bd create "Update URL mappings for new blog posts"
# In your code
import { UrlReferenceMapper } from '@mytechtoday/url-reference';
const mapper = new UrlReferenceMapper({ configPath: './url-references.json' });AI agents can execute multiple operations efficiently:
# Create a batch file
cat > operations.txt << EOF
add --title "Post 1" --url "https://example.com/1/" --path "/path/1.html"
add --title "Post 2" --url "https://example.com/2/" --path "/path/2.html"
validate
list --json
EOF
# Execute batch
npx url-ref-mapper batch --file operations.txtWindows:
[
{
"title": "Copper ETFs and Investment Vehicles: 2026",
"url": "https://mytech.today/copper-etfs-and-investment-vehicles-2026/",
"localPath": "C:\\projects\\blogs\\copper-mining-part-4-etf-investment-vehicles.html",
"lastUpdated": "2026-01-27T17:04:00-06:00"
}
]macOS/Linux:
[
{
"title": "Copper ETFs and Investment Vehicles: 2026",
"url": "https://mytech.today/copper-etfs-and-investment-vehicles-2026/",
"localPath": "/home/user/projects/blogs/copper-mining-part-4-etf-investment-vehicles.html",
"lastUpdated": "2026-01-27T17:04:00-06:00"
}
]Windows:
- title: Copper ETFs and Investment Vehicles: 2026
url: https://mytech.today/copper-etfs-and-investment-vehicles-2026/
localPath: C:\projects\blogs\copper-mining-part-4-etf-investment-vehicles.html
lastUpdated: '2026-01-27T17:04:00-06:00'macOS/Linux:
- title: Copper ETFs and Investment Vehicles: 2026
url: https://mytech.today/copper-etfs-and-investment-vehicles-2026/
localPath: /home/user/projects/blogs/copper-mining-part-4-etf-investment-vehicles.html
lastUpdated: '2026-01-27T17:04:00-06:00'This package works seamlessly across Windows, macOS, and Linux platforms.
Windows:
- Use backslashes:
C:\projects\blog\post.html - Or forward slashes:
C:/projects/blog/post.html - Both formats are supported and normalized internally
macOS/Linux:
- Use forward slashes:
/home/user/projects/blog/post.html - Absolute paths recommended for consistency
Windows (PowerShell):
# Initialize config
npx url-ref-mapper init
# Add mapping
npx url-ref-mapper add `
--title "My Post" `
--url "https://example.com/post/" `
--path "C:\projects\blog\post.html"
# Get URL
npx url-ref-mapper get-url "C:\projects\blog\post.html"macOS/Linux (Bash/Zsh):
# Initialize config
npx url-ref-mapper init
# Add mapping
npx url-ref-mapper add \
--title "My Post" \
--url "https://example.com/post/" \
--path "/home/user/projects/blog/post.html"
# Get URL
npx url-ref-mapper get-url "/home/user/projects/blog/post.html"npm test
npm run test:coverage# Clone the repository
git clone https://github.com/mytech-today-now/url-reference.git
cd url-reference
# Install dependencies
npm install
# Build
npm run build
# Run in development mode
npm run dev
# Lint
npm run lint
npm run lint:fix
# Format
npm run format# Build and test
npm run build
npm test
# Publish to npm
npm publishContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.
- Augment Code AI - AI coding assistant
- OpenSpec - Spec-driven development
- Beads - Distributed issue tracker
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built for the Augment AI community to solve the common problem of broken local file references in AI-generated content.
For complete CLI documentation, see the CLI Reference Guide.
Core Commands:
init- Initialize configurationadd- Add mappingremove- Remove mappinglist- List mappingsget-url- Get URL from pathget-path- Get path from URLvalidate- Validate mappingsexport- Export mappings
Advanced Features:
interactive- Start interactive modebatch- Execute batch commandscompletion- Manage tab completion
Utility Commands:
version- Show versionlicense- Show licensecredits- Show creditssponsor- Show sponsorship infodonate- Show donation infodoctor- Diagnose issuesuninstall- Uninstall package
Global Options:
--help, -h- Show help--version, -v- Show version--json- JSON output--verbose- Verbose output--quiet- Quiet output--no-color- Disable colors
No Breaking Changes! Version 2.0.0 is fully backward compatible with v1.x.
All existing commands work exactly as before. New features are additive:
# v1.x commands still work
npx url-ref-mapper init
npx url-ref-mapper add --title "Post" --url "..." --path "..."
npx url-ref-mapper list
# Plus new v2.0 features
npx url-ref-mapper list --json
npx url-ref-mapper doctor
npx url-ref-mapper interactiveNew Features to Explore:
- Try
--helpon any command for detailed documentation - Use
--jsonfor machine-readable output - Run
doctorto check your setup - Install tab completion for faster workflows
- Try interactive mode for multiple operations
Status: Production Ready | Version: 2.0.0 | Maintainer: MyTech.Today