Token Management CLI Commands#77
Merged
Merged
Conversation
Implement ParseDuration to extend standard time.ParseDuration with day notation support (e.g., 30d for 30 days). Includes validation functions for token and setup code expiry limits. Add FormatRelativeTime for human-readable relative timestamps. Uses appropriate granularity based on duration: minutes for under 1 hour, hours for under 1 day, days otherwise. Co-authored-by: construct-agent <noreply@construct.sh>
Create daemon token command group with display types for token listing and creation output. Define TokenDisplay for table output with relative time formatting, TokenCreateDisplay for create command output, and SetupCodeDisplay for setup code generation output. Wire token command group into daemon parent command. Co-authored-by: construct-agent <noreply@construct.sh>
Add daemon token create command to generate authentication tokens with configurable expiry and optional description. Displays token once in card format with security warning to save it securely. Add daemon token create-setup command to generate short-lived setup codes for secure token distribution. Outputs setup code with usage instructions for clients to exchange it. Both commands use custom duration parser for day notation and validate expiry limits before making API calls. Co-authored-by: construct-agent <noreply@construct.sh>
Add daemon token list command to display all tokens with metadata including ID, name, creation time, expiration, and status. Supports filtering by name prefix and including expired tokens. Converts timestamps to relative time format for readability. Add daemon token revoke command to invalidate tokens by UUID. Validates UUID format and prompts for confirmation before revoking. Uses force flag to skip confirmation prompt. Co-authored-by: construct-agent <noreply@construct.sh>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
construct daemon tokencommand group with create, list, and revoke subcommands for managing authentication tokens. Completes the CLI interface for the token-based authentication system.Context
With the authentication backend merged, administrators need CLI tools to manage tokens for remote daemon access. These commands provide the full lifecycle: creation, auditing, and revocation.
Changes
Commands Added
construct daemon token create <name>- Generate authentication tokensconstruct daemon token create-setup <name>- Generate single-use setup codesconstruct daemon token list- Display token metadataconstruct daemon token revoke <id>- Invalidate tokens by UUIDUtilities
30d,90d) with validationKey Features
Examples
Create token for developer
CI/CD token management
Audit and rotate tokens
Testing
Manual verification
Key scenarios to verify