Skip to content

Commit 3a92770

Browse files
committed
feat(cli): add teams, sources, and schema discovery commands
- Add `logchef teams` to list available teams - Add `logchef sources` to list sources for a team - Add `logchef schema` to show column names and types for a source - Improve error messages to guide users to discovery commands - Update CLI docs and skill file with new commands - Bump version to 0.1.4
1 parent 86df171 commit 3a92770

File tree

15 files changed

+941
-416
lines changed

15 files changed

+941
-416
lines changed

.agents/skills/logchef/SKILL.md

Lines changed: 133 additions & 404 deletions
Large diffs are not rendered by default.

.github/workflows/rust-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ jobs:
122122
args: "--locked --release"
123123
strip: true
124124
working-directory: cli
125+
use-rust-cache: false
125126

126127
- name: Build (cargo)
127128
if: ${{ !matrix.use_cross }}

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## [CLI v0.1.4] - 2026-02-05
9+
10+
### Added
11+
- **CLI `teams` command** — List teams available to your account.
12+
- **CLI `sources` command** — List sources for a team with IDs and `database.table` references.
13+
- **CLI `schema` command** — Show columns and types for a source without running SQL.
14+
15+
### Changed
16+
- CLI errors for missing team/source now suggest `logchef teams` and `logchef sources --team <team>`.
917

1018
## [1.3.0] - 2026-02-05
1119

cli/Cargo.lock

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

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resolver = "2"
33
members = ["crates/*"]
44

55
[workspace.package]
6-
version = "0.1.3"
6+
version = "0.1.4"
77
edition = "2024"
88
license = "AGPL-3.0"
99
repository = "https://github.com/mr-karan/logchef"

cli/crates/logchef-cli/src/cli.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anyhow::Result;
22
use clap::{CommandFactory, Parser, Subcommand};
33
use tracing_subscriber::EnvFilter;
44

5-
use crate::commands::{auth, collections, config, query, sql};
5+
use crate::commands::{auth, collections, config, query, schema, sources, sql, teams};
66

77
#[derive(Parser)]
88
#[command(name = "logchef")]
@@ -54,6 +54,15 @@ enum Commands {
5454
#[command(about = "List and run saved collections")]
5555
Collections(collections::CollectionsArgs),
5656

57+
#[command(about = "List available teams")]
58+
Teams(teams::TeamsArgs),
59+
60+
#[command(about = "List sources for a team")]
61+
Sources(sources::SourcesArgs),
62+
63+
#[command(about = "Show schema for a source")]
64+
Schema(schema::SchemaArgs),
65+
5766
#[command(about = "Manage CLI configuration")]
5867
Config(config::ConfigArgs),
5968
}
@@ -88,6 +97,9 @@ impl Cli {
8897
Some(Commands::Query(args)) => query::run(args, global).await,
8998
Some(Commands::Sql(args)) => sql::run(args, global).await,
9099
Some(Commands::Collections(args)) => collections::run(args, global).await,
100+
Some(Commands::Teams(args)) => teams::run(args, global).await,
101+
Some(Commands::Sources(args)) => sources::run(args, global).await,
102+
Some(Commands::Schema(args)) => schema::run(args, global).await,
91103
Some(Commands::Config(args)) => config::run(args).await,
92104
None => {
93105
let mut cmd = Cli::command();

cli/crates/logchef-cli/src/commands/collections.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ pub async fn run(args: CollectionsArgs, global: GlobalArgs) -> Result<()> {
134134
prompt_team_interactive(&client, &mut cache).await?
135135
} else {
136136
let team_input = arg_team.or(ctx.defaults.team.clone()).ok_or_else(|| {
137-
anyhow::anyhow!("Team not specified. Use --team or set defaults.team")
137+
anyhow::anyhow!(
138+
"Team not specified. Use --team or set defaults.team. List teams with 'logchef teams'."
139+
)
138140
})?;
139141

140142
match parse_identifier(&team_input) {
@@ -165,7 +167,9 @@ pub async fn run(args: CollectionsArgs, global: GlobalArgs) -> Result<()> {
165167
prompt_source_interactive(&client, team_id, &mut cache).await?
166168
} else {
167169
let source_input = arg_source.or(ctx.defaults.source.clone()).ok_or_else(|| {
168-
anyhow::anyhow!("Source not specified. Use --source or set defaults.source")
170+
anyhow::anyhow!(
171+
"Source not specified. Use --source or set defaults.source. List sources with 'logchef sources --team <team>'."
172+
)
169173
})?;
170174

171175
match parse_identifier(&source_input) {

cli/crates/logchef-cli/src/commands/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ pub mod auth;
22
pub mod collections;
33
pub mod config;
44
pub mod query;
5+
pub mod schema;
6+
pub mod sources;
57
pub mod sql;
8+
pub mod teams;

cli/crates/logchef-cli/src/commands/query.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ pub async fn run(args: QueryArgs, global: GlobalArgs) -> Result<()> {
124124
prompt_team_interactive(&client, &mut cache).await?
125125
} else {
126126
let team_input = args.team.or(ctx.defaults.team.clone()).ok_or_else(|| {
127-
anyhow::anyhow!("Team not specified. Use --team or set defaults.team")
127+
anyhow::anyhow!(
128+
"Team not specified. Use --team or set defaults.team. List teams with 'logchef teams'."
129+
)
128130
})?;
129131

130132
match parse_identifier(&team_input) {
@@ -155,7 +157,9 @@ pub async fn run(args: QueryArgs, global: GlobalArgs) -> Result<()> {
155157
prompt_source_interactive(&client, team_id, &mut cache).await?
156158
} else {
157159
let source_input = args.source.or(ctx.defaults.source.clone()).ok_or_else(|| {
158-
anyhow::anyhow!("Source not specified. Use --source or set defaults.source")
160+
anyhow::anyhow!(
161+
"Source not specified. Use --source or set defaults.source. List sources with 'logchef sources --team <team>'."
162+
)
159163
})?;
160164

161165
match parse_identifier(&source_input) {

0 commit comments

Comments
 (0)