Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0b13923
Remove globals.ts and relocate its contents to appropriate modules
sij411 Jan 30, 2026
e156336
Add unified configuration module for CLI
sij411 Jan 30, 2026
348a2b2
Add --config and --ignore-config CLI options
sij411 Jan 30, 2026
d552ea1
Simplify config module to use Optique's config system
sij411 Feb 3, 2026
d2495da
Add hierarchical config file loading with Optique integration
sij411 Feb 4, 2026
e4c538f
Version bump
dahlia Jan 23, 2026
9d4a589
Fix traverseCollection() for inline CollectionPage without id
moreal Jan 31, 2026
17a7261
Add bindConfig integration for CLI options
sij411 Feb 5, 2026
2856832
Add bindConfig integration for tunnel command
sij411 Feb 5, 2026
1fc6ba8
Extend config schema and add more bindConfig integrations
sij411 Feb 5, 2026
bde9d25
Add bindConfig for lookup and nodeinfo command options
sij411 Feb 5, 2026
88dd2cb
Update Optique to 0.10.0-dev.347
sij411 Feb 9, 2026
04cd3a5
Update CLI config schema to match issue spec
sij411 Feb 9, 2026
4299080
Bind all inbox command options with config
sij411 Feb 9, 2026
1e63a38
Bind webfinger command options with config
sij411 Feb 9, 2026
a63980a
Refactor userAgentOption
sij411 Feb 9, 2026
80d6826
Bind lookup command options with config
sij411 Feb 9, 2026
f2a7dc7
Wrap userAgentOption with object and update usages
sij411 Feb 9, 2026
06da72d
Remove tunnel-specific config binding from tunnel command
sij411 Feb 9, 2026
20b0892
Bind relay command options with config
sij411 Feb 9, 2026
b2466c4
Add configuration file documentation to CLI docs
sij411 Feb 9, 2026
6e747f3
Update CLI tests for bindConfig compatibility
sij411 Feb 10, 2026
4515816
Add changelog entry for CLI configuration file support
sij411 Feb 10, 2026
95919d6
Fix noFavicon config logic and update changelog command list
sij411 Feb 11, 2026
57a7b1f
Set webfinger command's default value to 5 and test codes
sij411 Feb 11, 2026
68ad48d
Fix package versions to 2.0.0
sij411 Feb 12, 2026
735f481
Update optique version to dev.355
sij411 Feb 12, 2026
d80c687
Fix unclosed tag in cli.md
sij411 Feb 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,19 @@ To be released.
to the existing `-s`/`--service` option in `fedify tunnel` for consistency.
[[#525], [#529], [#531] by Jiwon Kwon]

- Added configuration file support for persisting CLI options.
[[#265], [#562] by Jiwon Kwon]

- Configuration files are loaded hierarchically from system, user, and
project directories.
- Added `--config` (`-C`) option to specify a custom configuration file
path.
- Added `--ignore-config` option to skip loading configuration files.
- Configuration options are now bound to commands: `lookup`, `webfinger`,
`tunnel`, `relay`, `inbox`, and `nodeinfo`.

[Elysia]: https://elysiajs.com/
[#265]: https://github.com/fedify-dev/fedify/issues/265
[#374]: https://github.com/fedify-dev/fedify/issues/374
[#397]: https://github.com/fedify-dev/fedify/issues/397
[#408]: https://github.com/fedify-dev/fedify/issues/408
Expand All @@ -238,6 +250,7 @@ To be released.
[#525]: https://github.com/fedify-dev/fedify/issues/525
[#529]: https://github.com/fedify-dev/fedify/pull/529
[#531]: https://github.com/fedify-dev/fedify/pull/531
[#562]: https://github.com/fedify-dev/fedify/pull/562

### @fedify/debugger

Expand Down
1,033 changes: 519 additions & 514 deletions deno.lock

Large diffs are not rendered by default.

98 changes: 98 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,104 @@ the appropriate executable for your platform and put it in your `PATH`.
[releases]: https://github.com/fedify-dev/fedify/releases


Configuration file
------------------

*This feature is available since Fedify 2.0.0.*

The `fedify` command supports configuration files to set default values for
command options. Configuration files are written in [TOML] format.

[TOML]: https://toml.io/

### Configuration file locations

Configuration files are loaded from the following locations in order, with
later files taking precedence over earlier ones:

1. `/etc/fedify/config.toml` (system-wide)
2. *<user-config-dir>/fedify/config.toml* (user-level)
3. `.fedify.toml` in the current working directory (project-level)
4. Custom path via `--config` option (explicit)

The user config directory varies by operating system:

- **Linux**: *~/.config/fedify/config.toml*
- **macOS**: *~/Library/Application Support/fedify/config.toml*
- **Windows**: *%APPDATA%\\fedify\\config.toml*

### `--config`: Load an additional configuration file

You can specify an additional configuration file to load using the `--config`
option:

~~~~ sh
fedify --config ./my-config.toml lookup @user@example.com
~~~~

This file is loaded after all standard configuration files and takes the
highest precedence.

### `--ignore-config`: Ignore all configuration files

The `--ignore-config` option skips loading all configuration files. This is
useful for CI environments or when you want reproducible behavior:

~~~~ sh
fedify --ignore-config lookup @user@example.com
~~~~

### Configuration file structure

Below is an example configuration file showing all available options:

~~~~ toml
# Global settings (apply to all commands)
debug = false
userAgent = "MyApp/1.0"
tunnelService = "localhost.run" # "localhost.run", "serveo.net", or "pinggy.io"

[webfinger]
allowPrivateAddress = false
maxRedirection = 5

[lookup]
authorizedFetch = false
firstKnock = "draft-cavage-http-signatures-12" # or "rfc9421"
traverse = false
suppressErrors = false
defaultFormat = "default" # "default", "raw", "compact", or "expand"
separator = "----"
timeout = 30 # seconds

[inbox]
actorName = "Fedify Ephemeral Actor"
actorSummary = "An ephemeral actor for testing purposes."
authorizedFetch = false
noTunnel = false
follow = ["@user@example.com"]
acceptFollow = ["*"]

[relay]
protocol = "mastodon" # or "litepub"
port = 8000
name = "Fedify Relay"
persistent = "/path/to/relay.db" # optional, uses in-memory if not specified
noTunnel = false
acceptFollow = ["*"]
rejectFollow = []

[nodeinfo]
raw = false
bestEffort = false
showFavicon = true
showMetadata = false
~~~~

All configuration options are optional. Command-line arguments always take
precedence over configuration file values.


`fedify init`: Initializing a Fedify project
--------------------------------------------

Expand Down
5 changes: 4 additions & 1 deletion packages/amqp/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"pnpm-lock.yaml"
],
"publish": {
"exclude": ["**/*.test.ts", "tsdown.config.ts"]
"exclude": [
"**/*.test.ts",
"tsdown.config.ts"
]
},
"tasks": {
"build": "pnpm build",
Expand Down
16 changes: 10 additions & 6 deletions packages/cli/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,34 @@
"@inquirer/prompts": "npm:@inquirer/prompts@^7.8.4",
"@jimp/core": "npm:@jimp/core@^1.6.0",
"@jimp/wasm-webp": "npm:@jimp/wasm-webp@^1.6.0",
"@optique/core": "jsr:@optique/core@^0.9.0",
"@optique/run": "jsr:@optique/run@^0.9.0",
"@optique/config": "jsr:@optique/config@^0.10.0-dev.355",
"@optique/core": "jsr:@optique/core@^0.10.0-dev.355",
"@optique/run": "jsr:@optique/run@^0.10.0-dev.355",
"@poppanator/http-constants": "npm:@poppanator/http-constants@^1.1.1",
"chalk": "npm:chalk@^5.6.2",
"cli-table3": "npm:cli-table3@^0.6.5",
"env-paths": "npm:env-paths@^3.0.0",
"es-toolkit": "npm:es-toolkit@^1.39.4",
"fetch-mock": "npm:fetch-mock@^12.5.4",
"hono": "jsr:@hono/hono@^4.8.3",
"icojs": "npm:icojs@^0.19.5",
"inquirer-toggle": "npm:inquirer-toggle@^1.0.1",
"ora": "npm:ora@^8.2.0",
"shiki": "npm:shiki@^1.6.4",
"smol-toml": "npm:smol-toml@^1.6.0",
"srvx": "npm:srvx@^0.8.7",
"valibot": "npm:valibot@^1.2.0",
"#kv": "./src/kv.node.ts"
},
"exclude": [
"dist/",
"fedify-cli-*.tar.xz",
"fedify-cli-*.tgz",
"fedify-cli-*.zip"
"fedify-cli-*.zip",
"package.json",
"src/install.mjs",
"src/run.mjs"
],
"publish": {
"exclude": ["**/*.test.ts", "tsdown.config.ts", "scripts/"]
},
"tasks": {
"codegen": "deno task -f @fedify/vocab compile",
"check": {
Expand Down
72 changes: 45 additions & 27 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
{
"name": "@fedify/cli",
"version": "2.0.0",
"type": "module",
"files": [
"README.md",
"package.json",
"src/install.mjs",
"src/run.mjs"
],
"bin": {
"fedify": "./dist/mod.js"
},
"scripts": {
"build:self": "tsdown",
"build": "pnpm --filter @fedify/cli... run build:self",
"prepack": "pnpm build",
"prepublish": "pnpm build",
"pretest": "pnpm build",
"test": "node --test --experimental-transform-types 'src/**/*.test.ts' '!src/init/test/**'",
"test-init": "deno task test-init",
"pretest:bun": "pnpm build",
"test:bun": "bun test",
"run": "pnpm build && node dist/mod.js",
"runi": "tsdown && node dist/mod.js",
"run:bun": "pnpm build && bun dist/mod.js",
"runi:bun": "tsdown && bun dist/mod.js"
},
"engines": {
"node": ">=20.0.0",
"bun": ">=1.2.0",
"denp": ">=2.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The engines field contains "denp", which appears to be a typo for "deno". This could prevent engine checks from working correctly in Deno environments.

Suggested change
"denp": ">=2.0.0"
"deno": ">=2.0.0"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what -_-

},
"os": [
"darwin",
"linux",
"win32"
],
"cpu": [
"x64",
"arm64"
],
"description": "CLI toolchain for Fedify and debugging ActivityPub",
"keywords": [
"fedify",
Expand All @@ -27,15 +66,6 @@
"url": "git+https://github.com/fedify-dev/fedify.git",
"directory": "packages/cli"
},
"type": "module",
"engines": {
"node": ">=20.0.0",
"bun": ">=1.2.0",
"denp": ">=2.0.0"
},
"bin": {
"fedify": "./dist/mod.js"
},
"exports": "./dist/mod.js",
"imports": {
"#kv": {
Expand All @@ -59,8 +89,9 @@
"@js-temporal/polyfill": "catalog:",
"@logtape/file": "catalog:",
"@logtape/logtape": "catalog:",
"@optique/core": "^0.9.0",
"@optique/run": "^0.9.0",
"@optique/config": "0.10.0-dev.355",
"@optique/core": "0.10.0-dev.355",
"@optique/run": "0.10.0-dev.355",
"@poppanator/http-constants": "^1.1.1",
"byte-encodings": "catalog:",
"chalk": "^5.6.2",
Expand All @@ -77,27 +108,14 @@
"jimp": "^1.6.0",
"ora": "^8.2.0",
"shiki": "^1.6.4",
"srvx": "^0.8.7"
"smol-toml": "^1.6.0",
"srvx": "^0.8.7",
"valibot": "^1.2.0"
},
"devDependencies": {
"@types/bun": "catalog:",
"@types/node": "catalog:",
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build:self": "tsdown",
"build": "pnpm --filter @fedify/cli... run build:self",
"prepack": "pnpm build",
"prepublish": "pnpm build",
"pretest": "pnpm build",
"test": "node --test --experimental-transform-types 'src/**/*.test.ts' '!src/init/test/**'",
"test-init": "deno task test-init",
"pretest:bun": "pnpm build",
"test:bun": "bun test",
"run": "pnpm build && node dist/mod.js",
"runi": "tsdown && node dist/mod.js",
"run:bun": "pnpm build && bun dist/mod.js",
"runi:bun": "tsdown && bun dist/mod.js"
}
}
Loading
Loading