Skip to content

Commit b55b7ca

Browse files
authored
feat(skills): Add skill install command for CLI
1 parent e8f7567 commit b55b7ca

File tree

7 files changed

+523
-3
lines changed

7 files changed

+523
-3
lines changed

Cargo.lock

Lines changed: 95 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,16 @@ rand = "0.8"
2727
sha2 = "0.10"
2828
tiny_http = "0.12"
2929
comfy-table = "7"
30+
flate2 = "1"
31+
tar = "0.4"
32+
semver = "1"
3033

3134
[package.metadata.release]
3235
pre-release-hook = ["git", "cliff", "-o", "CHANGELOG.md", "--tag", "{{version}}" ]
3336
publish = false
37+
pre-release-replacements = [
38+
{ file = "skills/hotdata-cli/SKILL.md", search = "^version: .+", replace = "version: {{version}}", exactly = 1 },
39+
]
3440

3541
# The profile that 'dist' will build with
3642
[profile.dist]

dist-workspace.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ install-path = "~/.hotdata/cli"
2020
publish-jobs = ["homebrew"]
2121
# Whether to install an updater program
2222
install-updater = false
23+
24+
[[dist.extra-artifacts]]
25+
artifacts = ["skills.tar.gz"]
26+
build = ["tar", "-czf", "skills.tar.gz", "skills/"]

skills/hotdata-cli/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: hotdata-cli
33
description: Use this skill when the user wants to run hotdata CLI commands, query the HotData API, list workspaces, list connections, list tables, execute SQL queries, or interact with the hotdata service. Activate when the user says "run hotdata", "query hotdata", "list workspaces", "list connections", "list tables", "execute a query", or asks you to use the hotdata CLI.
4-
version: 1.0.0
4+
version: 0.1.3
55
---
66

77
# HotData CLI Skill

src/command.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ pub enum Commands {
6262
command: TablesCommands,
6363
},
6464

65+
/// Manage the hotdata-cli agent skill
66+
Skill {
67+
#[command(subcommand)]
68+
command: SkillCommands,
69+
},
70+
6571
/// Retrieve a stored query result by ID
6672
Results {
6773
/// Result ID
@@ -428,6 +434,18 @@ pub enum ConnectionsCommands {
428434
},
429435
}
430436

437+
#[derive(Subcommand)]
438+
pub enum SkillCommands {
439+
/// Install or update the hotdata-cli skill into agent directories
440+
Install {
441+
/// Install into the current project directory instead of globally
442+
#[arg(long)]
443+
project: bool,
444+
},
445+
/// Show the installation status of the hotdata-cli skill
446+
Status,
447+
}
448+
431449
#[derive(Subcommand)]
432450
pub enum TablesCommands {
433451
/// List all tables in a workspace

src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ mod connections;
55
mod init;
66
mod query;
77
mod results;
8+
mod skill;
89
mod tables;
910
mod util;
1011
mod workspace;
1112

1213
use anstyle::AnsiColor;
1314
use clap::{Parser, builder::Styles};
14-
use command::{AuthCommands, Commands, ConnectionsCommands, TablesCommands, WorkspaceCommands};
15+
use command::{AuthCommands, Commands, ConnectionsCommands, SkillCommands, TablesCommands, WorkspaceCommands};
1516

1617
#[derive(Parser)]
1718
#[command(name = "hotdata", version, about = concat!("HotData CLI - Command line interface for HotData (v", env!("CARGO_PKG_VERSION"), ")"), long_about = None, disable_version_flag = true)]
@@ -82,6 +83,12 @@ fn main() {
8283
tables::list(&workspace_id, connection_id.as_deref(), schema.as_deref(), table.as_deref(), limit, cursor.as_deref(), &format)
8384
}
8485
},
86+
Commands::Skill { command } => match command {
87+
SkillCommands::Install { project } => {
88+
if project { skill::install_project() } else { skill::install() }
89+
}
90+
SkillCommands::Status => skill::status(),
91+
},
8592
Commands::Results { result_id, workspace_id, format } => {
8693
let workspace_id = resolve_workspace(workspace_id);
8794
results::get(&result_id, &workspace_id, &format)

0 commit comments

Comments
 (0)