@papavault/cli v1.0.12
Papa Vault CLI
A command-line interface for interacting with the Papa Vault Secret Manager.
Visit papavault.com to learn more about Papa Vault.
Installation
Option 1: Using npm
npm install -g @papavault/cliOption 2: Using the installation script
curl -fsSL https://raw.githubusercontent.com/papavault/cli/main/install.sh | bashOption 3: Using npx
npx @papavault/cliUsage
Authentication
Authenticate with Papa Vault using your API token:
papavault loginYou can also provide the token directly:
papavault login --token YOUR_API_TOKENAlternative authentication methods:
- Set the
PAPAVAULT_TOKENenvironment variable - Create a
.env.papavaultfile in your project directory withPAPAVAULT_TOKEN=YOUR_API_TOKEN
Project Configuration
Set up your project and environment for secret syncing:
papavault set-projectThis will guide you through selecting a project and environment. The configuration will be saved in a .papavault.json file in your current directory.
You can also specify the project ID and stage directly:
papavault set-project --project-id YOUR_PROJECT_ID --stage YOUR_STAGESyncing Secrets
Sync secrets from Papa Vault to your local environment:
papavault syncThis will download all credential files for the configured project and environment.
Important: All files are synced relative to the location of the .papavault.json configuration file. The CLI will search for this file starting from your current directory and moving up through parent directories until it finds one.
For example, if your .papavault.json is in /path/to/project/ and a credential file path is specified as config/secrets.json, the file will be synced to /path/to/project/config/secrets.json.
Handling Special Paths
The CLI handles several special path cases:
Absolute Paths: If a credential file path is specified as an absolute path (starting with
/), the CLI will automatically convert it to a relative path by removing the leading slash. For example, if a credential file path is specified as/config/secrets.json, it will be treated asconfig/secrets.jsonand synced relative to the location of the.papavault.jsonfile.Root Path: If a credential file path is specified as just
/, the CLI will place the file directly in the directory where the.papavault.jsonfile is located, using the filename from the credential file.Directory Paths: If a credential file path resolves to a directory, the CLI will automatically append the filename to the path to ensure the file is created correctly.
Troubleshooting Sync Issues
If you encounter issues with the sync command, you can enable debug mode to get more detailed information:
papavault sync --debugThis will output detailed logs about the file paths and operations being performed, which can help identify the root cause of any issues.
Checking Status
Check your current authentication and project status:
papavault statusListing Projects
List all available projects and their environments:
papavault list-projectsLogging Out
Remove your stored API token:
papavault logoutConfiguration File
The CLI uses a .papavault.json file in your project directory to store the project ID and stage:
{
"projectId": "your-project-id",
"stage": "your-environment-id"
}The CLI will search for this file starting from your current working directory and moving up through parent directories. This allows you to run commands from any subdirectory within your project.
Help
For help with any command, use the --help flag:
papavault --help
papavault sync --help