File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,7 +79,9 @@ pub async fn run(args: Args) -> anyhow::Result<()> {
7979 }
8080
8181 if has_fail {
82- std:: process:: exit ( 1 ) ;
82+ return Err (
83+ crate :: util:: output:: SilentExit ( crate :: util:: output:: exit_code:: GENERAL ) . into ( ) ,
84+ ) ;
8385 }
8486
8587 Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ use crate::status;
1414
1515const SKILL_CONTENT : & str = include_str ! ( "../../../skills/steel-browser/SKILL.md" ) ;
1616
17+ const CURSOR_DESCRIPTION : & str =
18+ "Steel browser automation CLI for web tasks (scrape, screenshot, interactive browser sessions)" ;
19+
1720pub struct DetectedAgent {
1821 pub name : & ' static str ,
1922 pub install_path : PathBuf ,
@@ -70,9 +73,7 @@ pub fn detect_agents() -> Vec<DetectedAgent> {
7073/// stripping its YAML frontmatter and prepending Cursor-specific frontmatter.
7174fn cursor_rule_content ( ) -> String {
7275 let body = strip_frontmatter ( SKILL_CONTENT ) ;
73- format ! (
74- "---\n description: Steel browser automation CLI for web tasks (scrape, screenshot, interactive browser sessions)\n alwaysApply: false\n ---\n \n {body}"
75- )
76+ format ! ( "---\n description: {CURSOR_DESCRIPTION}\n alwaysApply: false\n ---\n \n {body}" )
7677}
7778
7879fn strip_frontmatter ( s : & str ) -> & str {
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ pub async fn run(args: Args) -> anyhow::Result<()> {
2929 // Step 1: login (no-ops if already logged in).
3030 login:: run ( login:: Args { } ) . await ?;
3131
32- // Step 2: preflight check (calls process::exit on failure) .
32+ // Step 2: preflight check.
3333 status ! ( "" ) ;
3434 doctor:: run ( doctor:: Args { preflight : true } ) . await ?;
3535
Original file line number Diff line number Diff line change @@ -69,6 +69,19 @@ pub mod exit_code {
6969 pub const API_SERVER : i32 = 6 ;
7070}
7171
72+ /// Sentinel error: the command already printed its own output and reported
73+ /// failure; the process should exit with `code` without printing anything else.
74+ #[ derive( Debug ) ]
75+ pub struct SilentExit ( pub i32 ) ;
76+
77+ impl std:: fmt:: Display for SilentExit {
78+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
79+ write ! ( f, "exit {}" , self . 0 )
80+ }
81+ }
82+
83+ impl std:: error:: Error for SilentExit { }
84+
7285// --- Pure formatting functions (no I/O) ---
7386
7487fn format_success ( json_mode : bool , data : & Value , text : & str ) -> Option < String > {
@@ -172,6 +185,10 @@ pub fn success_text(data: Value) {
172185
173186/// Format a top-level error for output, then exit. Called from main.
174187pub fn handle_error ( err : & anyhow:: Error ) -> ! {
188+ if let Some ( SilentExit ( code) ) = err. downcast_ref :: < SilentExit > ( ) {
189+ std:: process:: exit ( * code) ;
190+ }
191+
175192 let ( code, error_code, hint) = classify_error ( err) ;
176193 let msg = format ! ( "{err:#}" ) ;
177194
You can’t perform that action at this time.
0 commit comments