-
-
Notifications
You must be signed in to change notification settings - Fork 80
Labels
component/cliCLI tools relatedCLI tools relateddifficulty/beginnerBeginner friendlyBeginner friendlygood first issueGood for newcomersGood for newcomerstype/enhancementImprovements to existing featuresImprovements to existing featurestype/featureRequests for new featuresRequests for new features
Milestone
Description
Description
Add support for configuration files to the Fedify CLI tools to allow users to set default options and preferences. This will improve the developer experience by eliminating the need to repeatedly specify common options and allowing for project-specific configurations.
Implementation Details
- Support
.fedifyrc
(JSON format) andfedify.config.json
configuration files - Look for config files in the current directory, then user home directory
- Allow configuration of common options like:
- Default user-agent string
- Cache directory location
- Default output format preferences
- Timeout settings
- Debug/verbose mode preferences
- Command-line options should override config file settings
- Use existing JSON parsing patterns from the codebase
Why This Is a Good First Issue
- Clear requirements: Well-defined feature with obvious use cases
- Existing patterns: Can follow JSON handling patterns already used in the codebase
- Incremental implementation: Can start with basic options and expand gradually
- High impact: Significantly improves developer experience for regular CLI users
- Safe changes: Additive feature that doesn't break existing functionality
Acceptance Criteria
- Support
.fedifyrc
andfedify.config.json
configuration files - Search for config files in current directory, then home directory
- Allow configuration of common CLI options (user-agent, cache directory, etc.)
- Command-line options override config file settings
- Handle malformed config files gracefully with helpful error messages
- Add
--no-config
flag to ignore configuration files - Update help text to mention configuration file support
Configuration File Structure
{
"userAgent": "MyBot/1.0 (https://example.com/bot)",
"cacheDir": "~/.cache/fedify",
"defaultFormat": "json",
"timeout": 30000,
"verbose": false,
"followRedirects": true
}
Files to Create/Modify
cli/config.ts
- New configuration file handling logiccli/utils.ts
- Add config loading utilities- Multiple CLI command files - Update to use config values as defaults
Example Usage
# Create config file
echo '{"userAgent": "MyBot/1.0", "defaultFormat": "json"}' > .fedifyrc
# Commands now use config defaults
fedify lookup @[email protected] # Uses configured user-agent and format
# Override config with command line options
fedify lookup @[email protected] --format compact # Overrides defaultFormat
# Ignore config file
fedify lookup @[email protected] --no-config
Sub-issues
Metadata
Metadata
Assignees
Labels
component/cliCLI tools relatedCLI tools relateddifficulty/beginnerBeginner friendlyBeginner friendlygood first issueGood for newcomersGood for newcomerstype/enhancementImprovements to existing featuresImprovements to existing featurestype/featureRequests for new featuresRequests for new features