Download firm_cli/src/cli.rs from harvesthealth/browser-instance: direct link, hf CLI and curl.
- Browser
- Download file 3.86 kB
-
https://huggingface.co/spaces/harvesthealth/browser-instance/resolve/main/firm_cli/src/cli.rs
- Command line
-
hf download hf://spaces/harvesthealth/browser-instance/firm_cli/src/cli.rs
-
curl -L -o cli.rs https://huggingface.co/spaces/harvesthealth/browser-instance/resolve/main/firm_cli/src/cli.rs
3.86 kB
| use clap::{Parser, Subcommand}; | |
| use std::path::PathBuf; | |
| use super::query::CliDirection; | |
| use super::ui::OutputFormat; | |
| /// Defines the top-level interface for the Firm CLI with clap. | |
| pub struct FirmCli { | |
| /// Path to firm workspace directory. | |
| pub workspace: Option<PathBuf>, | |
| /// Use cached firm graph? | |
| pub cached: bool, | |
| /// Enable verbose output? | |
| pub verbose: bool, | |
| /// Output format | |
| pub format: OutputFormat, | |
| pub command: FirmCliCommand, | |
| } | |
| /// Defines the available subcommands of the Firm CLI. | |
| pub enum FirmCliCommand { | |
| /// Initialize a new Firm workspace with default schemas and files. | |
| Init, | |
| /// Build workspace and entity graph. | |
| Build, | |
| /// Get an entity or schema. | |
| Get { | |
| /// Entity type (e.g. person, organization) or "schema" | |
| target_type: String, | |
| /// Entity ID (e.g. john_doe) or schema name (e.g. project) | |
| target_id: String, | |
| }, | |
| /// List entities of a type, or list all schemas. | |
| List { | |
| /// Entity type (e.g. person, organization) or "schema" to list schemas | |
| target_type: String, | |
| }, | |
| /// Gets entities related to a given entity. | |
| Related { | |
| /// Entity type (e.g. person) | |
| entity_type: String, | |
| /// Entity ID (e.g. john_doe) | |
| entity_id: String, | |
| /// Direction of relationships (incoming, outgoing, or both if not specified) | |
| direction: Option<CliDirection>, | |
| }, | |
| /// Adds a new entity to a file in the workspace. If type, id or fields are not provided, this is done interactively. | |
| Add { | |
| /// Target firm file. | |
| to_file: Option<PathBuf>, | |
| /// Entity type for non-interactive mode (e.g., person, organization) | |
| r#type: Option<String>, | |
| /// Entity ID for non-interactive mode (e.g., john_doe) | |
| id: Option<String>, | |
| /// Field for non-interactive mode (can be repeated). Format: --field <field_name> <value> | |
| )] | |
| fields: Vec<String>, | |
| /// List declaration for non-interactive mode (can be repeated). Format: --list <field_name> <item_type> | |
| )] | |
| lists: Vec<String>, | |
| /// List value for non-interactive mode (can be repeated). Format: --list-value <field_name> <value> | |
| )] | |
| list_values: Vec<String>, | |
| }, | |
| /// Query entities in the workspace using a query language. | |
| Query { | |
| /// Query string (e.g., "from task | where is_completed == false | limit 5") | |
| query: String, | |
| }, | |
| /// Find the source file for an entity or schema. | |
| Source { | |
| /// Entity type (e.g. person, organization) or "schema" | |
| target_type: String, | |
| /// Entity ID (e.g. john_doe) or schema name (e.g. project) | |
| target_id: String, | |
| }, | |
| /// Check workspace files for errors. Optionally check a single file. | |
| Check { | |
| /// Path to a specific .firm file to check (checks entire workspace if omitted) | |
| file: Option<PathBuf>, | |
| }, | |
| /// Start the language server (stdio transport). | |
| Lsp, | |
| /// Start the MCP server (stdio transport). | |
| Mcp, | |
| } | |