Introducing a new way to review your PRs.

Read the announcement

jdx / fnox

encrypted/remote secret manager

View on GitHub

27 documents · Updated Nov 23, 2026

docs / provider-and-diagnostic-commands

Provider and diagnostic commands

Provider and diagnostic commands help engineers connect fnox to secret stores, inspect the providers available to a profile, check access, and remove provider entries. They also expose health reports, configuration metadata, shell support, release information, sponsorship output, and CI secret masking without replacing the main secret-management workflows described in Secret and configuration commands.

Command scope

The command surface has two paths. Read and diagnostic commands use the effective configuration for the selected profiles, while provider add and remove write to an explicit configuration scope.

Configuration and profile context

The effective profile stack controls which providers read operations can see. Top-level providers form the base, and selected profiles can add or replace them. Listing, discovery, testing, doctor, and CI redaction therefore describe the merged provider or secret view.

Provider add and remove choose their write target from explicit profile flags. With more than one profile selected, --write-profile is required. Without a profile target, the commands write the top-level provider set. --global selects the per-user configuration file, while the default config path can resolve a local configuration through the project hierarchy.

References: src/…/mod.rs• L80-146 src/…/mod.rs• L376-451 src/…/add.rs• L71-107

Provider management

Provider management covers the provider lifecycle: discover items where supported, register a typed provider entry, view effective providers, test access, and remove an entry. Provider names link secret declarations to the systems that supply or protect their values.

This diagram shows how provider writes and provider reads relate to the effective profile view.

flowchart LR
    A[Provider add] --> B[Provider entry]
    B --> C[Effective provider view]
    C --> D[Provider discover]
    C --> E[Provider list]
    C --> F[Provider test]
    C --> G[Doctor health report]
    B --> H[Provider remove]

Provider registration

fnox provider add <PROVIDER> <PROVIDER_TYPE> creates a named provider entry with starter settings for the selected type. The supported types span network services, local stores, encryption providers, hardware-backed providers, and Lua plugins. The command rejects a duplicate name in the target scope and reports the file that needs further setup.

The command writes to the project configuration by default. --global writes to the user configuration, and an explicit CLI profile or --write-profile places the entry under that profile. Provider add uses explicit CLI profile flags for this choice; a profile from FNOX_PROFILE or other settings does not redirect the write. --plugin is valid only for lua; --vault is valid only for proton-pass. AWS and GCP CLI choices create their corresponding Secrets Manager entries. FIDO2 and YubiKey choices perform hardware setup before saving the provider entry.

References: src/…/mod.rs• L18-127 src/…/add.rs• L8-50 src/…/add.rs• L52-127 src/…/add.rs• L129-459

Provider discovery

fnox provider discover <PROVIDER> finds provider items without exposing their secret fields. The current discovery path supports 1Password and can narrow results with repeated or comma-separated --tags; --json returns item metadata as a JSON array. Discovery uses the selected profile's provider configuration and does not change fnox.toml.

Provider listing

fnox provider list prints the names in the effective provider set in sorted order. fnox provider uses the same listing behavior when no subcommand is given. Hidden completion support uses this provider-name output as a dynamic completion source.

References: src/…/discover.rs• L7-12 src/…/discover.rs• L25-77 src/…/list.rs• L5-41

Provider connectivity checks

fnox provider test <PROVIDER> resolves the provider configuration and its referenced values before checking access. This makes the result useful for both setup and connection problems. --all tests every effective provider, prints pass and fail totals, and returns an error when any provider fails. --verbose adds individual failure details. A passing provider test does not prove that each secret exists.

References: src/…/test.rs• L5-11 src/…/test.rs• L31-75 src/…/test.rs• L78-177

Provider removal

fnox provider remove <PROVIDER> deletes a named provider from the selected configuration scope. It does not delete data from the provider itself. A secret that still references the removed provider cannot resolve, and a missing file or provider causes an error without changing another configuration layer.

References: src/…/remove.rs• L5-24 src/…/remove.rs• L26-77

Diagnostic and metadata commands

Diagnostic commands help engineers assess configuration health. Metadata commands describe the CLI for tools and support workflows. Most metadata commands do not load configuration; doctor and CI redaction are configuration-backed exceptions.

Doctor report

fnox doctor produces a human-readable report for the selected profile. It validates configuration, counts secrets and providers, shows the selected profile environment, and tests provider health without resolving secret values. It also warns when an exported FNOX_AGE_KEY conflicts with a setting intended to keep secrets out of the shell.

Use fnox check when the goal is to validate resolved secret values rather than inspect configuration and provider health.

References: src/…/doctor.rs• L7-13 src/…/doctor.rs• L23-39 src/…/doctor.rs• L41-93 src/…/doctor.rs• L96-139 src/…/doctor.rs• L142-159

Configuration schema

fnox schema prints a pretty-printed JSON Schema for the configuration model. The schema gives editors and automation a machine-readable contract for validation and configuration completion.

References: src/…/schema.rs• L5-13 crates/…/config.rs• L1761-1784 docs/…/configuration.md• L5-24

Usage specification and shell completion

fnox usage prints the CLI usage specification by combining command definitions with extra dynamic completion rules. fnox completion <SHELL> converts that specification into a completion script for Bash, Zsh, Fish, Elvish, Nushell, or PowerShell.

Completion can offer values from the active configuration instead of only static flags. Provider names, secret names, profiles, and config paths come from their matching runtime sources.

This diagram shows how command metadata becomes shell support.

flowchart LR
    A[CLI command definitions] --> B[Usage specification]
    C[Dynamic completion rules] --> B
    B --> D[Usage command]
    D --> E[Completion script]
    E --> F[Shell]

References: src/…/usage.rs• L4-13 src/…/completion.rs• L4-39 src/…/mod.rs• L239-334 src/…/fnox-extras.usage.kdl• L1-13

Version and sponsorship output

fnox version prints the program name and release version for scripts and support reports. fnox sponsors prints the current sponsor list and the page with the full list. These commands provide informational output without loading configuration.

References: src/…/version.rs• L5-13 src/…/sponsors.rs• L4-13 src/…/mod.rs• L350-361

CI secret redaction

CI redaction converts resolved secret values into masking instructions for supported continuous integration systems. fnox ci-redact is hidden because it supports pipeline setup rather than normal interactive work.

CI masking

fnox ci-redact first requires a detected CI environment and then selects a masking format for its vendor. GitHub Actions receives one ::add-mask:: instruction for each resolved single-line secret. The command uses the selected profile and configured missing-secret behavior while resolving values.

GitLab CI and CircleCI do not support the runtime masking operation used here, so the command directs users to protected variables. Unknown vendors fail instead of guessing a format. GitHub Actions multiline values are skipped with a warning because a runtime mask cannot fully protect them.

This diagram shows the safety checks before fnox emits a CI instruction.

flowchart LR
    A[CI environment] --> B{Supported vendor?}
    B -- No --> C[Explain vendor limit]
    B -- Yes --> D[Resolve profile secrets]
    D --> E{Single-line value?}
    E -- No --> F[Warn and skip mask]
    E -- Yes --> G[Emit vendor mask instruction]

References: src/…/ci_redact.rs• L7-24 src/…/ci_redact.rs• L26-74 src/…/ci_redact.rs• L76-109 test/ci_redact.bats• L28-81 test/ci_redact.bats• L212-239

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep provider type names, type-specific add options, and the configuration variants created by provider add aligned.
  • Check both effective-profile reads and explicit-profile writes when changing profile overlay or provider write-target rules.
  • Keep provider discovery output limited to metadata and aligned with the provider capability that supports discovery.
  • Review provider reference resolution and connection checks together because provider test and doctor depend on the same access path.
  • Update schema consumers when the configuration model changes because schema is the machine-facing contract.
  • Keep CLI metadata and src/assets/fnox-extras.usage.kdl aligned when command names or completion argument sources change.
  • Treat CI vendor detection, mask syntax, missing-secret handling, and multiline handling as one external contract.

Important failure modes

TriggerConsequenceGuard
More than one profile is active during provider add or remove without --write-profileThe command refuses to select a write layerSet one explicit write profile before changing provider configuration
A profile is selected only through FNOX_PROFILE or settings during provider addThe provider is written to the top-level or explicit write target instead of that profilePass the profile with the CLI profile flag or --write-profile
A provider name already exists in the target scopeAdd fails without replacing the existing entryUse a new name or remove the old entry first
A provider add option is used with the wrong provider typeAdd fails before it changes configurationUse --plugin only with lua and --vault only with proton-pass
Discovery targets a provider other than 1PasswordDiscovery fails because the provider does not support item discoveryUse a configured 1Password provider
A provider name is absent from the selected scopeRemove fails without changing another configuration layerSelect the profile or global file that owns the provider
Provider references cannot resolve or a provider cannot connectA provider test fails; an all-provider test returns a failure summaryRun the test with --verbose and fix the provider setup or credentials
Configuration validation fails before a config-backed command runsThe command stops before its normal report or actionFix the reported configuration issue
Completion generation receives an unsupported shellNo completion script is producedRequest one of the supported shell formats
ci-redact runs outside CI or under an unsupported vendorNo masking instructions are emitted and the command returns an errorUse protected CI variables or a supported runtime mask
A GitHub Actions secret contains newlinesThe value is skipped and is not fully protected by a runtime maskStore multiline material in a secret manager or another protected CI input

Key files

FileWhy to read it
src/…/mod.rsDefines the top-level command tree, profile flags, dynamic completion sources, and configuration loading boundary.
src/…/mod.rsDefines provider subcommands, provider type names, and the dispatch between provider lifecycle actions.
src/…/add.rsShows how provider registration validates type-specific options, chooses a scope, and creates a starter entry.
src/…/discover.rsShows metadata-only provider discovery and its 1Password-specific output modes.
src/…/list.rsShows how the effective provider set becomes command output and completion input.
src/…/test.rsShows single-provider and all-provider health check behavior.
src/…/remove.rsShows how provider deletion targets a local, global, or profile scope.
src/…/doctor.rsShows the configuration and provider checks in the diagnostic report.
src/…/ci_redact.rsDefines CI vendor detection and the secret masking contract.
src/…/schema.rsDefines the machine-readable configuration schema command.
src/…/usage.rs and src/…/completion.rsExplain the path from CLI metadata to generated shell completion.
src/assets/fnox-extras.usage.kdlDefines dynamic completion sources for providers, secrets, profiles, and config files.
crates/…/config.rsDefines profile selection, provider overlays, config loading, and validation used by these commands.
crates/…/mod.rsDefines the shared provider capabilities and connection-check boundary.