diff --git a/caffeine_cli/src/caffeine_cli.gleam b/caffeine_cli/src/caffeine_cli.gleam index e216112..f8225fb 100644 --- a/caffeine_cli/src/caffeine_cli.gleam +++ b/caffeine_cli/src/caffeine_cli.gleam @@ -217,7 +217,6 @@ fn dispatch(parsed: ParsedArgs) -> Result(Nil, String) { let check = get_bool_flag(parsed.flags, "check") handler.run_format(quiet, check, parsed.positional) } - "artifacts" -> handler.run_artifacts(quiet) "types" -> handler.run_types(quiet) "explain" -> handler.run_explain(parsed.positional) other -> Error(unknown_command_message(other)) diff --git a/caffeine_cli/src/caffeine_cli/args.gleam b/caffeine_cli/src/caffeine_cli/args.gleam index 6fae0c8..d26fdb5 100644 --- a/caffeine_cli/src/caffeine_cli/args.gleam +++ b/caffeine_cli/src/caffeine_cli/args.gleam @@ -71,15 +71,6 @@ pub fn commands() -> List(CommandSpec) { "caffeine format expectations/ --check", ], ), - CommandSpec( - name: "artifacts", - summary: "List standard-library artifacts", - signature: "", - description: "Print the catalog of artifacts (e.g. SLO) provided by Caffeine's " - <> "standard library, including each artifact's parameters and types.", - flags: [FlagSpec("--quiet", "Suppress decorative output")], - examples: ["caffeine artifacts"], - ), CommandSpec( name: "types", summary: "Show the type-system reference", diff --git a/caffeine_cli/src/caffeine_cli/display.gleam b/caffeine_cli/src/caffeine_cli/display.gleam index a5771dd..182dc1a 100644 --- a/caffeine_cli/src/caffeine_cli/display.gleam +++ b/caffeine_cli/src/caffeine_cli/display.gleam @@ -1,10 +1,5 @@ import caffeine_cli/color.{type ColorMode} -import caffeine_lang/linker/artifacts.{type ParamInfo} -import caffeine_lang/types.{ - type AcceptedTypes, type TypeMeta, Defaulted, ModifierType, OneOf, Optional, - RefinementType, -} -import gleam/dict +import caffeine_lang/types.{type TypeMeta} import gleam/list import gleam/string @@ -27,49 +22,6 @@ pub fn pretty_print_category( header <> "\n\n" <> type_entries } -/// Pretty-prints SLO params showing name, description, and type details. -pub fn pretty_print_slo_params( - params: dict.Dict(String, ParamInfo), - mode: ColorMode, -) -> String { - let header = - color.bold(color.cyan("SLO", mode), mode) - <> ": " - <> color.dim( - "\"A Service Level Objective that monitors a metric query against a threshold over a rolling window.\"", - mode, - ) - let param_lines = - params - |> dict.to_list - |> list.sort(fn(a, b) { string.compare(a.0, b.0) }) - |> list.map(fn(pair) { - let #(name, param_info) = pair - " " - <> color.yellow(name, mode) - <> ": " - <> color.dim("\"" <> param_info.description <> "\"", mode) - <> "\n type: " - <> color.green(types.accepted_type_to_string(param_info.type_), mode) - <> "\n " - <> param_status(param_info.type_, mode) - }) - |> string.join("\n") - - header <> "\n\n" <> param_lines -} - -/// Returns the status of a parameter: "required", "optional", or "default: ". -fn param_status(typ: AcceptedTypes, mode: ColorMode) -> String { - case typ { - ModifierType(Optional(_)) -> color.dim("optional", mode) - ModifierType(Defaulted(_, default)) -> - color.blue("default: " <> default, mode) - RefinementType(OneOf(inner, _)) -> param_status(inner, mode) - _ -> color.magenta("required", mode) - } -} - /// Pretty-prints a single type entry. fn pretty_print_type_meta(meta: TypeMeta, mode: ColorMode) -> String { let name_line = diff --git a/caffeine_cli/src/caffeine_cli/explanations.gleam b/caffeine_cli/src/caffeine_cli/explanations.gleam index a163f71..ab3ed9a 100644 --- a/caffeine_cli/src/caffeine_cli/explanations.gleam +++ b/caffeine_cli/src/caffeine_cli/explanations.gleam @@ -71,7 +71,7 @@ pub fn all() -> Dict(String, Explanation) { "An artifact reference whose template body is malformed.", "A standard-library artifact the linker doesn't recognize.", ], - fix: "Check the artifact name and argument list against `caffeine artifacts`. If you wrote a custom artifact reference, verify its template syntax.", + fix: "Check the artifact name and argument list in the offending fragment. If you wrote a custom artifact reference, verify its template syntax.", link: option.Some(docs_root <> "E301"), ), @@ -125,7 +125,7 @@ pub fn all() -> Dict(String, Explanation) { "A `$`-prefixed reference without a matching parameter definition.", "Template argument count doesn't match the template's parameter list.", ], - fix: "Locate the template named in the error and verify its body is well-formed. Artifact templates live in the standard library — `caffeine artifacts` lists them.", + fix: "Locate the template named in the error and verify its body is well-formed.", link: option.Some(docs_root <> "E402"), ), @@ -164,7 +164,7 @@ pub fn all() -> Dict(String, Explanation) { "Measurement uses a vendor Caffeine's current build doesn't support.", "Vendor name was normalized unexpectedly (check case and spelling).", ], - fix: "Check `caffeine artifacts` or the project's supported-vendor list. If the vendor should be supported, this is a compiler bug — please file it.", + fix: "Check the project's supported-vendor list. If the vendor should be supported, this is a compiler bug — please file it.", link: option.Some(docs_root <> "E500"), ), diff --git a/caffeine_cli/src/caffeine_cli/handler.gleam b/caffeine_cli/src/caffeine_cli/handler.gleam index 9b3404b..bf7a5b3 100644 --- a/caffeine_cli/src/caffeine_cli/handler.gleam +++ b/caffeine_cli/src/caffeine_cli/handler.gleam @@ -15,7 +15,6 @@ import caffeine_lang/constants import caffeine_lang/errors import caffeine_lang/frontend/formatter import caffeine_lang/source_file.{SourceFile, VendorMeasurementSource} -import caffeine_lang/standard_library/artifacts as stdlib_artifacts import caffeine_lang/types import filepath import gleam/bool @@ -81,12 +80,6 @@ pub fn run_format( format_command(path, check_only, log_level) } -/// Run the artifacts command. -@internal -pub fn run_artifacts(quiet: Bool) -> Result(Nil, String) { - artifacts_catalog(log_level_from_quiet(quiet), color.detect_color_mode()) -} - /// Run the types command. @internal pub fn run_types(quiet: Bool) -> Result(Nil, String) { @@ -378,22 +371,6 @@ fn write_file(path: String, content: String) -> Result(Nil, String) { }) } -fn artifacts_catalog( - log_level: LogLevel, - mode: color.ColorMode, -) -> Result(Nil, String) { - compile_presenter.log(log_level, "Artifact Catalog") - compile_presenter.log(log_level, string.repeat("=", 16)) - compile_presenter.log(log_level, "") - - stdlib_artifacts.slo_params() - |> display.pretty_print_slo_params(mode) - |> compile_presenter.log(log_level, _) - - compile_presenter.log(log_level, "") - Ok(Nil) -} - fn types_catalog( log_level: LogLevel, mode: color.ColorMode, diff --git a/caffeine_cli/test/caffeine_cli/args_test.gleam b/caffeine_cli/test/caffeine_cli/args_test.gleam index be55330..8a038d2 100644 --- a/caffeine_cli/test/caffeine_cli/args_test.gleam +++ b/caffeine_cli/test/caffeine_cli/args_test.gleam @@ -8,7 +8,7 @@ import gleeunit/should pub fn commands_lists_all_subcommands_test() { let names = args.command_names() - ["compile", "format", "artifacts", "types", "explain"] + ["compile", "format", "types", "explain"] |> list.each(fn(expected) { case list.contains(names, expected) { True -> Nil @@ -83,9 +83,9 @@ pub fn usage_message_includes_signature_test() { } pub fn usage_message_omits_signature_for_no_arg_command_test() { - let assert Some(spec) = args.find("artifacts") + let assert Some(spec) = args.find("types") let msg = args.usage_message(spec) - msg |> should.equal("Usage: caffeine artifacts") + msg |> should.equal("Usage: caffeine types") } // --- usage_for --- diff --git a/caffeine_cli/test/caffeine_cli/display_test.gleam b/caffeine_cli/test/caffeine_cli/display_test.gleam index 0cb833c..2de2a50 100644 --- a/caffeine_cli/test/caffeine_cli/display_test.gleam +++ b/caffeine_cli/test/caffeine_cli/display_test.gleam @@ -1,46 +1,11 @@ import caffeine_cli/color import caffeine_cli/display -import caffeine_lang/linker/artifacts.{ParamInfo} import caffeine_lang/types.{TypeMeta} -import gleam/dict import gleam/string import gleeunit/should -import test_helpers const off = color.ColorDisabled -// ==== pretty_print_slo_params ==== -// * ✅ includes SLO name -// * ✅ includes param names -// * ✅ includes param descriptions -// * ✅ includes param types -// * ✅ includes param status (required/optional/default) -pub fn pretty_print_slo_params_test() { - let params = - dict.from_list([ - #( - "my_param", - ParamInfo( - type_: types.PrimitiveType(types.String), - description: "My param description", - ), - ), - ]) - let output = display.pretty_print_slo_params(params, off) - - // Verify all expected content is present in the output - [ - #("includes SLO name", "SLO", True), - #("includes param names", "my_param", True), - #("includes param descriptions", "My param description", True), - #("includes param types", "String", True), - #("includes param status (required/optional/default)", "required", True), - ] - |> test_helpers.table_test_1(fn(substring) { - string.contains(output, substring) - }) -} - // ==== pretty_print_category ==== // * ✅ empty types list -> header only // * ✅ single type -> header + type entry diff --git a/caffeine_cli/test/caffeine_cli/distance_test.gleam b/caffeine_cli/test/caffeine_cli/distance_test.gleam index 8722fa6..a5d6f4b 100644 --- a/caffeine_cli/test/caffeine_cli/distance_test.gleam +++ b/caffeine_cli/test/caffeine_cli/distance_test.gleam @@ -34,7 +34,7 @@ pub fn levenshtein_unrelated_test() { // --- nearest --- pub fn nearest_finds_close_match_test() { - let candidates = ["compile", "format", "artifacts"] + let candidates = ["compile", "format", "types"] distance.nearest("compil", candidates, max_distance: 2) |> should.equal(Some("compile")) } @@ -47,7 +47,7 @@ pub fn nearest_picks_closest_when_multiple_test() { } pub fn nearest_returns_none_when_too_far_test() { - let candidates = ["compile", "format", "artifacts"] + let candidates = ["compile", "format", "types"] distance.nearest("xyzzy", candidates, max_distance: 2) |> should.equal(None) } diff --git a/caffeine_cli/test/caffeine_cli/handler_test.gleam b/caffeine_cli/test/caffeine_cli/handler_test.gleam index bef5d99..21b4b05 100644 --- a/caffeine_cli/test/caffeine_cli/handler_test.gleam +++ b/caffeine_cli/test/caffeine_cli/handler_test.gleam @@ -97,13 +97,6 @@ pub fn format_exit_code_test() { |> should.be_error() } -// ==== Artifacts Command ==== -// * ✅ artifacts returns Ok -pub fn artifacts_exit_code_test() { - caffeine_cli.run(["artifacts", "--quiet"]) - |> should.be_ok() -} - // ==== Types Command ==== // * ✅ types returns Ok pub fn types_exit_code_test() { diff --git a/caffeine_cli/test/caffeine_cli/help_test.gleam b/caffeine_cli/test/caffeine_cli/help_test.gleam index f410f7d..583c476 100644 --- a/caffeine_cli/test/caffeine_cli/help_test.gleam +++ b/caffeine_cli/test/caffeine_cli/help_test.gleam @@ -20,7 +20,7 @@ pub fn themed_includes_tagline_test() { pub fn themed_lists_all_commands_test() { let out = help.render(off, Themed, True) - ["compile", "format", "artifacts", "types"] + ["compile", "format", "types"] |> all_present(out) } @@ -91,7 +91,7 @@ pub fn plain_does_not_use_themed_tagline_test() { pub fn plain_lists_all_commands_test() { let out = help.render(off, Plain, True) - ["compile", "format", "artifacts", "types"] + ["compile", "format", "types"] |> all_present(out) }