Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Supported shells: `bash`, `zsh`, `fish`, `powershell`, `elvish`.
| API tools | `scrape`, `screenshot`, `pdf` |
| Local runtime | `dev install`, `dev start`, `dev stop` |
| Credentials | `credentials list`, `credentials create`, `credentials update`, `credentials delete` |
| Account and utility | `login`, `logout`, `config`, `doctor`, `cache`, `update`, `completion` |
| Account and utility | `login`, `logout`, `config`, `doctor`, `feedback`, `cache`, `update`, `completion` |

Full flags and schemas: [CLI reference](docs/cli-reference.md).

Expand Down
20 changes: 20 additions & 0 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Steel CLI - browser automation for AI agents. This file is generated from `steel
- [steel profile delete](#steel-profile-delete)
- [steel describe](#steel-describe)
- [steel doctor](#steel-doctor)
- [steel feedback](#steel-feedback)
- [steel skills](#steel-skills)
- [steel skills list](#steel-skills-list)
- [steel skills install](#steel-skills-install)
Expand Down Expand Up @@ -1626,6 +1627,25 @@ steel doctor

- `--preflight` (boolean, optional): Only check auth and API connectivity

## steel feedback

Send feedback to the Steel team: a bug, a docs problem, or a request

### Usage

```bash
steel feedback
```

### Parameters

- `category` (enum, required): What kind of feedback this is
- `message` (string, required): What happened or what you need, in a few sentences
- `--goal` (string, optional): What you were trying to do
- `--command` (string, optional): The Steel command that failed, with its arguments
- `--error` (string, optional): The error or output you got
- `--page` (string, optional): For docs feedback, the docs page it is about

## steel skills

Manage Steel agent skills
Expand Down
15 changes: 15 additions & 0 deletions docs/references/agent-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ steel browser start --local --session "$SESSION_NAME"
- Stale state:
`steel browser stop --all`, then start a new named session.

## Report Problems to Steel

If a command keeps failing in a way you cannot fix, tell the Steel team:

```bash
steel feedback bug "browser start fails every time" \
--goal "open example.com" \
--command "steel browser start --session $SESSION_NAME" \
--error "internal_error"
```

Use `docs` when the docs are wrong, `product` when Steel lacks something you
need, and `other` for anything else. Send only what you observed about Steel.
Never include page content, user data or keys.

## PR/CI Hygiene for Agent Logs

- never print `STEEL_API_KEY` directly.
Expand Down
1 change: 1 addition & 0 deletions docs/references/steel-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ For generated flags and argument schemas, use [../cli-reference.md](../cli-refer
- `steel login`: device login; approve the shown code in any browser. `--resume` continues a saved request, `--no-wait` returns while approval is pending, `--no-browser` skips opening a browser. Reports an existing API key instead of starting device login.
- `steel logout`: revoke the device login's refresh grant, then forget local auth (state is kept if revocation fails). `--local-only` forgets local state without contacting the server; revoke the device in your account too. Issued access tokens stay valid until they expire.
- `steel config`: print current auth/session context.
- `steel feedback <category> <message>`: send feedback to the Steel team. Categories are `bug`, `docs`, `product` and `other`. `--goal`, `--command`, `--error` and `--page` add context. Needs a login or API key.
- `steel settings`: switch persisted local/cloud preference.
- `steel cache`: clean cache.
- `steel update`: update CLI.
Expand Down
65 changes: 65 additions & 0 deletions src/api/feedback.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
use serde_json::Value;

use crate::api::client::{ApiError, SteelClient};

impl SteelClient {
pub async fn send_feedback(&self, body: &Value) -> Result<Value, ApiError> {
self.request(reqwest::Method::POST, "/feedback/agent", Some(body.clone()))
.await
}
}

#[cfg(test)]
mod tests {
use serde_json::json;
use wiremock::matchers::{body_json, header, method, path};
use wiremock::{Mock, MockServer, ResponseTemplate};

use super::*;
use crate::config::auth::{Auth, AuthSource};
use crate::config::settings::ApiMode;

fn client(server: &MockServer, api_key: Option<&str>) -> SteelClient {
let auth = Auth {
api_key: api_key.map(Into::into),
access_token: None,
source: AuthSource::Env,
};
SteelClient::with(server.uri(), ApiMode::Cloud, auth).unwrap()
}

#[tokio::test]
async fn sends_feedback_with_the_api_key() {
let server = MockServer::start().await;
let body = json!({"category": "bug", "message": "browser start fails"});

Mock::given(method("POST"))
.and(path("/feedback/agent"))
.and(header("Steel-Api-Key", "test-key"))
.and(body_json(&body))
.respond_with(ResponseTemplate::new(200).set_body_json(json!({"id": "f-1"})))
.expect(1)
.mount(&server)
.await;

let data = client(&server, Some("test-key"))
.send_feedback(&body)
.await
.unwrap();

assert_eq!(data["id"], "f-1");
}

#[tokio::test]
async fn refuses_to_send_without_signing_in() {
let server = MockServer::start().await;

let err = client(&server, None)
.send_feedback(&json!({"category": "bug", "message": "x"}))
.await
.unwrap_err();

assert!(matches!(err, ApiError::MissingAuth));
assert!(server.received_requests().await.unwrap().is_empty());
}
}
1 change: 1 addition & 0 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod client;
pub mod commands;
pub mod feedback;
pub mod generated;
pub mod profiles;
pub mod projects;
Expand Down
135 changes: 135 additions & 0 deletions src/commands/feedback.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
use clap::{Parser, ValueEnum};
use serde_json::{Value, json};

use crate::api::client::SteelClient;
use crate::util::output;

#[derive(Clone, Copy, Debug, PartialEq, Eq, ValueEnum)]
pub enum Category {
/// Steel failed or did the wrong thing
Bug,
/// Steel's docs are wrong, missing something or unclear
Docs,
/// Steel lacks something you need
Product,
/// Anything else
Other,
}

impl Category {
const fn as_str(self) -> &'static str {
match self {
Self::Bug => "bug",
Self::Docs => "docs",
Self::Product => "product",
Self::Other => "other",
}
}
}

#[derive(Parser)]
#[command(after_help = "Examples:
steel feedback bug \"browser start fails every time\" --command \"steel browser start\" --error \"internal_error\"
steel feedback docs \"The timeout default is wrong\" --page sessions/timeouts
steel feedback product \"I need to download files from a session\"")]
pub struct Args {
/// What kind of feedback this is
#[arg(value_enum)]
pub category: Category,

/// What happened or what you need, in a few sentences
pub message: String,

/// What you were trying to do
#[arg(long)]
pub goal: Option<String>,

/// The Steel command that failed, with its arguments
#[arg(long)]
pub command: Option<String>,

/// The error or output you got
#[arg(long)]
pub error: Option<String>,

/// For docs feedback, the docs page it is about
#[arg(long)]
pub page: Option<String>,
}

impl Args {
fn body(&self) -> Value {
let mut body = json!({
"category": self.category.as_str(),
"message": self.message,
});
for (key, value) in [
("goal", &self.goal),
("command", &self.command),
("error", &self.error),
("page", &self.page),
] {
if let Some(value) = value {
body[key] = json!(value);
}
}
body
}
}

pub async fn run(args: Args) -> anyhow::Result<()> {
output::suppress_feedback_hint();
let response = SteelClient::new()?.send_feedback(&args.body()).await?;
let id = response
.get("id")
.and_then(Value::as_str)
.unwrap_or_default();

output::success(
json!({ "id": id }),
&format!("Sent to the Steel team. Reference: {id}\n"),
);
Ok(())
}

#[cfg(test)]
mod tests {
use super::*;

fn args(category: Category) -> Args {
Args {
category,
message: "browser start fails".into(),
goal: None,
command: None,
error: None,
page: None,
}
}

#[test]
fn body_carries_only_the_fields_given() {
assert_eq!(
args(Category::Product).body(),
json!({"category": "product", "message": "browser start fails"})
);
let full = Args {
goal: Some("open a page".into()),
command: Some("steel browser start".into()),
error: Some("internal_error".into()),
page: Some("sessions/timeouts".into()),
..args(Category::Bug)
};
assert_eq!(
full.body(),
json!({
"category": "bug",
"message": "browser start fails",
"goal": "open a page",
"command": "steel browser start",
"error": "internal_error",
"page": "sessions/timeouts",
})
);
}
}
7 changes: 7 additions & 0 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub mod credentials;
pub mod describe;
pub mod dev;
pub mod doctor;
pub mod feedback;
pub mod forge;
pub mod init;
pub mod login;
Expand Down Expand Up @@ -59,6 +60,7 @@ const EXAMPLES: &[&str] = &[
"steel browser tab new https://example.com",
"steel browser stop --session my-session",
"steel sessions list --metadata env=prod --signal captcha_encountered",
"steel feedback bug \"browser start keeps failing\" --command \"steel browser start\"",
];

fn long_help(root: &clap::Command) -> String {
Expand Down Expand Up @@ -177,6 +179,9 @@ pub enum Command {
/// Check environment, auth, and connectivity
Doctor(doctor::Args),

/// Send feedback to the Steel team: a bug, a docs problem, or a request
Feedback(feedback::Args),

/// Manage Steel agent skills
Skills(skills::Args),

Expand Down Expand Up @@ -205,6 +210,7 @@ fn telemetry_command_path(command: &Command) -> Option<String> {
Command::Profile { command } => Some(format!("profile.{}", command.telemetry_name())),
Command::Describe(_) => Some("describe".to_string()),
Command::Doctor(_) => Some("doctor".to_string()),
Command::Feedback(_) => Some("feedback".to_string()),
Command::Skills(args) => Some(format!("skills.{}", skills::telemetry_name(&args.command))),
Command::Completion(_) => Some("completion".to_string()),
}
Expand Down Expand Up @@ -250,6 +256,7 @@ pub async fn run(cli: Cli) -> anyhow::Result<()> {
Command::Profile { command } => profile::run(command).await,
Command::Describe(args) => describe::run(args).await,
Command::Doctor(args) => doctor::run(args).await,
Command::Feedback(args) => feedback::run(args).await,
Command::Skills(args) => skills::run(args.command).await,
Command::Completion(args) => completion::run(args).await,
};
Expand Down
Loading
Loading