content-ledger-cli
v0.1.1
Published
CLI for Content Ledger
Downloads
20
Readme
content-ledger-cli
content-ledger-cli is a command line client for Content Ledger. It is designed for operators, scripts, CI jobs, and agent-style automation.
Features
- API key based authentication
- Local config persistence
- Content query and write operations
- User API key self-management
- JSON and text output modes
Requirements
- Node.js 20+
Install
From this repository:
npm install
npm run build -w cliRun directly:
node cli/dist/index.js --helpWhen published to npm, the package name is intended to be:
npm install -g content-ledger-cliQuick Start
Non-interactive:
clp auth init --api-key <api-key> --base-url http://localhost:3000/api
clp auth whoami
clp content listInteractive:
clp auth initIf you omit --api-key in an interactive terminal, the CLI will prompt for baseUrl and apiKey.
For first-time environment bootstrap, the API can optionally create an initial admin key from the BOOTSTRAP_ADMIN_API_KEY environment variable. That value should be supplied by the deployer, not committed to source control.
Config Sources
Configuration priority:
- CLI flags
- Environment variables
- Local config file
Supported environment variables:
CONTENT_LEDGER_BASE_URLCONTENT_LEDGER_API_KEYCONTENT_LEDGER_OUTPUT
Local config path:
- Windows:
%USERPROFILE%\.content-ledger-cli\config.json - macOS / Linux:
~/.content-ledger-cli/config.json
Common Commands
clp auth whoami
clp content list --status draft
clp content get --id <content-id>
clp content create --file ./content.json
clp content review --id <content-id>
clp content publish --id <content-id> --channels ch-medium
clp user api-key list
clp user api-key create --name "My CLI Key"
clp user api-key revoke --key-id <key-id>
clp user api-key delete --key-id <key-id> --forceInput Modes
Write commands support:
--file <path>--stdin
Example:
cat ./content.json | clp content create --stdinOutput Modes
--output json--output text
json is recommended for automation.
Tests
npm run test -w cliDocs
Detailed usage documentation:
