Skip to content

Commit d1bf15b

Browse files
cli: Remove dead code from codebase
Remove hosted_reconciliation module (1110 lines of unused webhook intake, signature verification, and commit mapping logic). Remove unused styling helpers (example_command, heading_stderr, placeholder, status_implemented, status_placeholder) and update callers to use alternatives. Remove unused exit code constants and migrate tests to FailureClass::exit_code(). Clean up remaining dead_code markers and remove truly dead functions. Update context documentation to reflect removals. Co-authored-by: SCE <sce@crocoder.dev>
1 parent 8a96750 commit d1bf15b

19 files changed

Lines changed: 82 additions & 1407 deletions

.opencode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"@opencode-ai/plugin": "1.3.11"
3+
"@opencode-ai/plugin": "1.3.13"
44
}
55
}

cli/src/app.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ use crate::{cli_schema, command_surface, services};
55
use anyhow::Context;
66
use services::error::{ClassifiedError, FailureClass};
77

8-
#[allow(dead_code)]
9-
const EXIT_CODE_PARSE_FAILURE: u8 = 2;
10-
#[allow(dead_code)]
11-
const EXIT_CODE_VALIDATION_FAILURE: u8 = 3;
12-
#[allow(dead_code)]
13-
const EXIT_CODE_RUNTIME_FAILURE: u8 = 4;
14-
#[allow(dead_code)]
15-
const EXIT_CODE_DEPENDENCY_FAILURE: u8 = 5;
16-
178
#[derive(Clone, Debug, Eq, PartialEq)]
189
enum Command {
1910
Help,
@@ -127,7 +118,7 @@ where
127118
};
128119

129120
let styled_code = services::style::error_code(error.code());
130-
let styled_heading = services::style::heading_stderr("Error");
121+
let styled_heading = services::style::heading("Error");
131122
let styled_message =
132123
services::style::error_text(&services::security::redact_sensitive_text(&rendered));
133124

@@ -746,9 +737,9 @@ mod tests {
746737

747738
use super::{
748739
parse_command, run, run_with_dependency_check, run_with_dependency_check_and_streams,
749-
write_error_diagnostic, Command, EXIT_CODE_DEPENDENCY_FAILURE, EXIT_CODE_PARSE_FAILURE,
750-
EXIT_CODE_RUNTIME_FAILURE, EXIT_CODE_VALIDATION_FAILURE,
740+
write_error_diagnostic, Command,
751741
};
742+
use crate::services::error::FailureClass;
752743

753744
#[test]
754745
fn successful_output_is_written_to_stdout() {
@@ -840,7 +831,7 @@ mod tests {
840831
&mut stdout,
841832
&mut stderr,
842833
);
843-
assert_eq!(code, ExitCode::from(EXIT_CODE_PARSE_FAILURE));
834+
assert_eq!(code, ExitCode::from(FailureClass::Parse.exit_code()));
844835
assert!(stdout.is_empty());
845836

846837
let stderr = String::from_utf8(stderr).expect("stderr should be utf-8");
@@ -882,7 +873,7 @@ mod tests {
882873
&mut first_stdout,
883874
&mut first_stderr,
884875
);
885-
assert_eq!(first_code, ExitCode::from(EXIT_CODE_PARSE_FAILURE));
876+
assert_eq!(first_code, ExitCode::from(FailureClass::Parse.exit_code()));
886877
assert!(first_stdout.is_empty());
887878

888879
let mut second_stdout = Vec::new();
@@ -893,7 +884,7 @@ mod tests {
893884
&mut second_stdout,
894885
&mut second_stderr,
895886
);
896-
assert_eq!(second_code, ExitCode::from(EXIT_CODE_PARSE_FAILURE));
887+
assert_eq!(second_code, ExitCode::from(FailureClass::Parse.exit_code()));
897888
assert!(second_stdout.is_empty());
898889

899890
let first_stderr = String::from_utf8(first_stderr).expect("stderr should be utf-8");
@@ -912,7 +903,7 @@ mod tests {
912903
&mut stdout,
913904
&mut stderr,
914905
);
915-
assert_eq!(code, ExitCode::from(EXIT_CODE_DEPENDENCY_FAILURE));
906+
assert_eq!(code, ExitCode::from(FailureClass::Dependency.exit_code()));
916907
assert!(stdout.is_empty());
917908

918909
let stderr = String::from_utf8(stderr).expect("stderr should be utf-8");
@@ -929,7 +920,7 @@ mod tests {
929920
#[test]
930921
fn hooks_command_without_subcommand_exits_non_zero() {
931922
let code = run(vec!["sce".to_string(), "hooks".to_string()]);
932-
assert_eq!(code, ExitCode::from(EXIT_CODE_PARSE_FAILURE));
923+
assert_eq!(code, ExitCode::from(FailureClass::Parse.exit_code()));
933924
}
934925

935926
#[test]
@@ -972,7 +963,7 @@ mod tests {
972963
#[test]
973964
fn unknown_command_exits_non_zero() {
974965
let code = run(vec!["sce".to_string(), "does-not-exist".to_string()]);
975-
assert_eq!(code, ExitCode::from(EXIT_CODE_PARSE_FAILURE));
966+
assert_eq!(code, ExitCode::from(FailureClass::Parse.exit_code()));
976967
}
977968

978969
#[test]
@@ -983,7 +974,7 @@ mod tests {
983974
"--repo".to_string(),
984975
"../demo-repo".to_string(),
985976
]);
986-
assert_eq!(code, ExitCode::from(EXIT_CODE_VALIDATION_FAILURE));
977+
assert_eq!(code, ExitCode::from(FailureClass::Validation.exit_code()));
987978
}
988979

989980
#[test]
@@ -994,15 +985,15 @@ mod tests {
994985
"commit-msg".to_string(),
995986
"/definitely/missing/COMMIT_EDITMSG".to_string(),
996987
]);
997-
assert_eq!(code, ExitCode::from(EXIT_CODE_RUNTIME_FAILURE));
988+
assert_eq!(code, ExitCode::from(FailureClass::Runtime.exit_code()));
998989
}
999990

1000991
#[test]
1001992
fn dependency_failure_uses_dependency_exit_code() {
1002993
let code = run_with_dependency_check(vec!["sce".to_string(), "--help".to_string()], || {
1003994
anyhow::bail!("simulated dependency check failure")
1004995
});
1005-
assert_eq!(code, ExitCode::from(EXIT_CODE_DEPENDENCY_FAILURE));
996+
assert_eq!(code, ExitCode::from(FailureClass::Dependency.exit_code()));
1006997
}
1007998

1008999
#[test]

cli/src/cli_schema.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ pub struct Cli {
1111
}
1212

1313
impl Cli {
14-
#[allow(dead_code)]
15-
pub fn parse_from<I, T>(args: I) -> Self
16-
where
17-
I: IntoIterator<Item = T>,
18-
T: Into<std::ffi::OsString> + Clone,
19-
{
20-
<Self as Parser>::parse_from(args)
21-
}
22-
2314
pub fn try_parse_from<I, T>(args: I) -> Result<Self, clap::Error>
2415
where
2516
I: IntoIterator<Item = T>,

cli/src/command_surface.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt::Write;
22

33
use crate::services;
4-
use services::style::{command_name, example_command, heading};
4+
use services::style::{command_name, heading};
55

66
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
77
pub enum ImplementationStatus {
@@ -108,7 +108,7 @@ pub fn help_text() -> String {
108108
{}:\n {} [--fix] [--all-databases] [--format <text|json>]\n\n\
109109
{}:\n {} --shell <bash|zsh|fish>\n\n\
110110
{}:\n Supported commands accept --format <text|json>\n\n\
111-
{}:\n {}\n {}\n {}\n {}\n {}\n {}\n {}\n\n\
111+
{}:\n sce setup\n sce setup --opencode --non-interactive --hooks\n sce setup --hooks --repo ../demo-repo\n sce doctor --format json\n sce doctor --all-databases --format json\n sce doctor --fix\n sce version --format json\n\n\
112112
{}:\n{command_rows}",
113113
heading("sce - Shared Context Engineering CLI"),
114114
heading("Usage"),
@@ -122,13 +122,6 @@ pub fn help_text() -> String {
122122
command_name("sce completion"),
123123
heading("Output format contract"),
124124
heading("Examples"),
125-
example_command("sce setup"),
126-
example_command("sce setup --opencode --non-interactive --hooks"),
127-
example_command("sce setup --hooks --repo ../demo-repo"),
128-
example_command("sce doctor --format json"),
129-
example_command("sce doctor --all-databases --format json"),
130-
example_command("sce doctor --fix"),
131-
example_command("sce version --format json"),
132125
heading("Commands"),
133126
)
134127
}

0 commit comments

Comments
 (0)