# new CredentialsCommand()
Provides a secure alternative to plaintext token files by resolving
secrets from environment variables, the OS keychain (macOS Keychain, Linux
libsecret/keyring), or — as a deprecated fallback — legacy plaintext files.
Supports get, store, setup, and git-helper actions.
Command-line tool for managing secrets via the OS keychain.
Example
```sh
# Resolve the npm token (prints to stdout)
credentials --action get --name npm
# Store a custom secret in the keychain
credentials --action store --name my-api --service "my-app:api" --account "default" --value "secret123"
# Interactive one-time enrollment
credentials --action setup
# Configure the OS-native git credential helper
credentials --action git-helper
```
Extends
Members
Logger
# log
Static logger for the Command class.
Static logger for the Command class.
- Inherited From:
Methods
# async protected checkRequirements() → {Promise.<void>}
Retrieves the list of dependencies and compares it against the required dependencies for the command.
Checks if all required dependencies are present.
- Overrides:
A promise that resolves when the check is complete.
Promise.<void>
# async execute() → {Promise.<(R|string|void)>}
This method handles the overall execution flow of the command, including parsing arguments, setting up logging, checking for version or help requests, and running the command.
Executes the command.
- Overrides:
A promise that resolves with the command's result.
Promise.<(R|string|void)>
# protected help(args) → {void}
This method should be overridden in derived classes to provide specific help information.
Provides help information for the command.
Parameters:
| Name | Type | Description |
|---|---|---|
args |
ParseArgsResult
|
The parsed command-line arguments. |
- Overrides:
void
# abstract protected run(answers) → {Promise.<(R|string|void)>}
This method should be implemented in derived classes to define the command's behavior.
Runs the command with the provided arguments.
Parameters:
| Name | Type | Description |
|---|---|---|
answers |
ParseArgsResult
|
The parsed command-line arguments. |
- Overrides:
A promise that resolves with the command's result.
Promise.<(R|string|void)>