-
Notifications
You must be signed in to change notification settings - Fork 24
Document token CLI JSON output and CI/Terraform bootstrapping #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -134,13 +134,15 @@ Manages authentication tokens for token-based authentication. The token command | |
| Creates a new authentication token. | ||
|
|
||
| ```bash | ||
| agent-memory token add --description "DESCRIPTION" [--expires-days DAYS] | ||
| agent-memory token add --description "DESCRIPTION" [--expires-days DAYS] [--format text|json] [--token TOKEN_VALUE] | ||
| ``` | ||
|
|
||
| **Options:** | ||
|
|
||
| - `--description TEXT` / `-d TEXT`: **Required**. Description for the token (e.g., "API access for service X") | ||
| - `--expires-days INTEGER` / `-e INTEGER`: **Optional**. Number of days until token expires. If not specified, token never expires. | ||
| - `--format [text|json]`: **Optional**. Output format. `text` (default) is human-readable; `json` is machine-readable and recommended for CI or scripting. | ||
| - `--token TEXT`: **Optional**. Use a pre-generated token value instead of having the CLI generate one. The CLI will hash and store the provided token; make sure you've stored the plaintext securely in your secrets manager or CI system. | ||
|
|
||
| **Examples:** | ||
|
|
||
|
|
@@ -150,6 +152,12 @@ agent-memory token add --description "API access token" --expires-days 30 | |
|
|
||
| # Create a permanent token (no expiration) | ||
| agent-memory token add --description "Service account token" | ||
|
|
||
| # Create a token and return JSON (for CI/scripts) | ||
| agent-memory token add --description "CI token" --expires-days 30 --format json | ||
|
|
||
| # Register a pre-generated token (e.g., from a secrets manager) | ||
| agent-memory token add --description "Terraform bootstrap" --token "$MY_TOKEN" --format json | ||
| ``` | ||
|
|
||
| **Security Note:** The generated token is displayed only once. Store it securely as it cannot be retrieved again. | ||
|
|
@@ -159,7 +167,28 @@ agent-memory token add --description "Service account token" | |
| Lists all authentication tokens, showing masked token hashes, descriptions, and expiration dates. | ||
|
|
||
| ```bash | ||
| agent-memory token list | ||
| agent-memory token list [--format text|json] | ||
| ``` | ||
|
|
||
| When `--format json` is used, the command prints a JSON array of token summaries suitable for scripting and CI pipelines. The default `text` format produces human-readable output like the example below. | ||
|
||
| **JSON Output Example:** | ||
| ```json | ||
| [ | ||
| { | ||
| "hash": "abc12345def67890xyz", | ||
| "description": "API access token", | ||
| "created_at": "2025-07-10T18:30:00.000000+00:00", | ||
| "expires_at": "2025-08-09T18:30:00.000000+00:00", | ||
| "status": "Active" | ||
| }, | ||
| { | ||
| "hash": "def09876uvw54321...", | ||
| "description": "Service account token", | ||
| "created_at": "2025-07-10T19:00:00.000000+00:00", | ||
| "expires_at": null, | ||
| "status": "Never Expires" | ||
| } | ||
| ] | ||
| ``` | ||
|
|
||
| **Example Output:** | ||
|
|
@@ -183,7 +212,19 @@ Expires: Never | |
| Shows detailed information about a specific token. Supports partial hash matching for convenience. | ||
|
|
||
| ```bash | ||
| agent-memory token show TOKEN_HASH | ||
| agent-memory token show TOKEN_HASH [--format text|json] | ||
| ``` | ||
|
|
||
| When `--format json` is used, the command prints a JSON object with token details (including status) suitable for scripting and CI pipelines. The default `text` format produces human-readable output. | ||
| **JSON Output Example:** | ||
| ```json | ||
| { | ||
| "hash": "abc12345def67890xyz", | ||
| "description": "API access token", | ||
| "created_at": "2025-07-10T18:30:00.000000+00:00", | ||
| "expires_at": "2025-08-09T18:30:00.000000+00:00", | ||
| "status": "Active" | ||
| } | ||
| ``` | ||
|
|
||
|
||
| **Arguments:** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example assumes the JSON output contains a
.tokenfield (usingjq -r '.token'), but the documentation doesn't specify the JSON schema returned bytoken add --format json.Consider adding a brief description of the JSON output structure, for example: