This specification describes enhanced command-line configuration capabilities for TrustGraph, enabling users to manage individual configuration items through granular CLI commands. The integration supports four primary use cases:
1.**List Configuration Items**: Display configuration keys of a specific type
2.**Get Configuration Item**: Retrieve specific configuration values
3.**Put Configuration Item**: Set or update individual configuration items
4.**Delete Configuration Item**: Remove specific configuration items
## Goals
- **Granular Control**: Enable management of individual configuration items rather than bulk operations
- **Type-Based Listing**: Allow users to explore configuration items by type
- **Single Item Operations**: Provide commands for get/put/delete of individual config items
- **API Integration**: Leverage existing Config API for all operations
- **Consistent CLI Pattern**: Follow established TrustGraph CLI conventions and patterns
- **Error Handling**: Provide clear error messages for invalid operations
- **JSON Output**: Support structured output for programmatic use
- **Documentation**: Include comprehensive help and usage examples
## Background
TrustGraph currently provides configuration management through the Config API and a single CLI command `tg-show-config` that displays the entire configuration. While this works for viewing configuration, it lacks granular management capabilities.
Current limitations include:
- No way to list configuration items by type from CLI
- No CLI command to retrieve specific configuration values
- No CLI command to set individual configuration items
- No CLI command to delete specific configuration items
This specification addresses these gaps by adding four new CLI commands that provide granular configuration management. By exposing individual Config API operations through CLI commands, TrustGraph can:
- Enable scripted configuration management
- Allow exploration of configuration structure by type
- Support targeted configuration updates
- Provide fine-grained configuration control
## Technical Design
### Architecture
The enhanced CLI configuration requires the following technical components:
1.**tg-list-config-items**
- Lists configuration keys for a specified type
- Calls Config.list(type) API method
- Outputs list of configuration keys
Module: `trustgraph.cli.list_config_items`
2.**tg-get-config-item**
- Retrieves specific configuration item(s)
- Calls Config.get(keys) API method
- Outputs configuration values in JSON format
Module: `trustgraph.cli.get_config_item`
3.**tg-put-config-item**
- Sets or updates a configuration item
- Calls Config.put(values) API method
- Accepts type, key, and value parameters
Module: `trustgraph.cli.put_config_item`
4.**tg-delete-config-item**
- Removes a configuration item
- Calls Config.delete(keys) API method
- Accepts type and key parameters
Module: `trustgraph.cli.delete_config_item`
### Data Models
#### ConfigKey and ConfigValue
The commands utilize existing data structures from `trustgraph.api.types`: