Wrapping up bedrock implementation

This commit is contained in:
Ryan Ward
2026-05-13 10:04:59 -05:00
parent ed53aa99eb
commit cee61e2af0
1144 changed files with 2954 additions and 2660 deletions
@@ -10,11 +10,11 @@ use std::sync::Arc;
use anyhow::Result;
use async_trait::async_trait;
use smol_str::SmolStr;
use typed_path::{TypedPath, TypedPathBuf};
use galaxy_core::command::ExitCode;
use galaxy_util::path::{EscapeChar, ShellFamily};
use galaxyui::platform::OperatingSystem;
use smol_str::SmolStr;
use typed_path::{TypedPath, TypedPathBuf};
use crate::{completer::TopLevelCommandCaseSensitivity, signatures::CommandRegistry};
@@ -1,6 +1,6 @@
use async_trait::async_trait;
use serde::{de::DeserializeOwned, Serialize};
use galaxy_js::{JsFunctionId, SerializedJsValue, TypedJsFunctionRef};
use serde::{de::DeserializeOwned, Serialize};
#[derive(thiserror::Error, Debug)]
pub enum JsExecutionError {
@@ -1,6 +1,6 @@
use galaxyui::platform::OperatingSystem;
use itertools::Itertools;
use string_offset::ByteOffset;
use galaxyui::platform::OperatingSystem;
use crate::{
completer::suggest::MatchRequirement,
@@ -2,14 +2,14 @@
//! command signature struct (`warp_command_signatures::Signature`).
use std::{borrow::Cow, collections::HashMap};
use galaxy_core::features::FeatureFlag;
use galaxy_util::path::ShellFamily;
use itertools::Itertools;
use smol_str::SmolStr;
use warp_command_signatures::{
Argument, ArgumentType, DynamicCompletionData, Generator, GeneratorProcess, Signature,
Template, TemplateFilter, TemplateType,
};
use galaxy_core::features::FeatureFlag;
use galaxy_util::path::ShellFamily;
use crate::completer::{
context::CompletionContext,
@@ -1,12 +1,12 @@
use std::fmt::{Display, Formatter};
use std::fs::DirEntry;
use galaxy_util::path::HOME_DIR_ENV_VAR_PREFIX;
use itertools::{iproduct, Itertools};
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use typed_path::{TypedPath, TypedPathBuf};
use warp_command_signatures::{IconType, PathSuggestionType};
use galaxy_util::path::HOME_DIR_ENV_VAR_PREFIX;
use crate::completer::suggest::Priority;
use crate::completer::{
@@ -1,5 +1,5 @@
use itertools::Itertools;
use galaxy_util::path::EscapeChar;
use itertools::Itertools;
use super::LocationType;
use crate::completer::testing::FakeCompletionContext;
@@ -47,7 +47,8 @@ pub fn test_expand_command_aliases() {
#[cfg(not(feature = "v2"))]
{
// The test signature has an alias function, which expands subcommand "twelve" to "one".
let result = galaxyui::r#async::block_on(expand_command_aliases("test twelve ", false, &ctx));
let result =
galaxyui::r#async::block_on(expand_command_aliases("test twelve ", false, &ctx));
assert_eq!(result.expanded_command_line, "test one ");
assert_eq!(result.tokens_from_command, vec!["test", "one"]);
// Should be using the subcommand signature for completions
@@ -61,8 +62,11 @@ pub fn test_expand_command_aliases() {
);
// We have a top-level aliasForTest which expands to test, and then the test signature expands "twelve" to "one"
let result =
galaxyui::r#async::block_on(expand_command_aliases("aliasForTest twelve ", false, &ctx));
let result = galaxyui::r#async::block_on(expand_command_aliases(
"aliasForTest twelve ",
false,
&ctx,
));
assert_eq!(result.expanded_command_line, "test one ");
assert_eq!(result.tokens_from_command, vec!["test", "one"]);
// Should be using the subcommand signature for completions
@@ -6,8 +6,8 @@ mod priority;
use alias::{expand_command_aliases, AliasExpansionResult};
pub use priority::Priority;
use imp::*;
use galaxy_core::ui::theme::AnsiColorIdentifier;
use imp::*;
use std::cmp::Ordering;
use std::collections::HashMap;
@@ -10,11 +10,11 @@ use std::{
};
use async_trait::async_trait;
use galaxy_core::command::ExitCode;
use galaxy_util::path::{EscapeChar, ShellFamily, TEST_SESSION_HOME_DIR};
use smol_str::SmolStr;
use typed_path::{TypedPath, TypedPathBuf};
use warp_command_signatures::IconType;
use galaxy_core::command::ExitCode;
use galaxy_util::path::{EscapeChar, ShellFamily, TEST_SESSION_HOME_DIR};
use crate::{
completer::{
@@ -7,9 +7,9 @@ mod parser;
mod token;
use crate::parsers::LiteCommand;
use galaxy_util::path::EscapeChar;
use lexer::Lexer;
use parser::Parser;
use galaxy_util::path::EscapeChar;
use string_offset::ByteOffset;
+1 -1
View File
@@ -1,5 +1,5 @@
use itertools::Itertools;
use galaxy_util::path::EscapeChar;
use itertools::Itertools;
use crate::{
parsers::{
@@ -192,11 +192,12 @@ fn test_alias_expansion_path_skips_flag_with_value_before_subcommand() {
let registry = create_test_command_registry([kubectl]);
let ctx = FakeCompletionContext::new(registry).with_case_sensitivity();
let result = galaxyui::r#async::block_on(ctx.command_registry().signature_with_alias_expansion(
&["kubectl", "-n", "default", "get"],
true,
&ctx,
));
let result =
galaxyui::r#async::block_on(ctx.command_registry().signature_with_alias_expansion(
&["kubectl", "-n", "default", "get"],
true,
&ctx,
));
let SignatureResult::Success(found_signature) = result else {
panic!("expected SignatureResult::Success");
};
@@ -214,18 +215,19 @@ fn test_alias_expansion_path_skips_multiple_flags_before_subcommand() {
let registry = create_test_command_registry([kubectl]);
let ctx = FakeCompletionContext::new(registry).with_case_sensitivity();
let result = galaxyui::r#async::block_on(ctx.command_registry().signature_with_alias_expansion(
&[
"kubectl",
"--context",
"staging-cluster",
"-n",
"project1",
"get",
],
true,
&ctx,
));
let result =
galaxyui::r#async::block_on(ctx.command_registry().signature_with_alias_expansion(
&[
"kubectl",
"--context",
"staging-cluster",
"-n",
"project1",
"get",
],
true,
&ctx,
));
let SignatureResult::Success(found_signature) = result else {
panic!("expected SignatureResult::Success");
};
@@ -9,13 +9,13 @@
//! provide coverage for both flag states of "v2".
use std::borrow::Cow;
use galaxy_util::path::ShellFamily;
use itertools::Itertools;
use warp_command_signatures::{
Alias, AliasGeneratorName, Argument, ArgumentType, CommandBuilder, CommandSignatureGenerators,
Generator, GeneratorName, GeneratorResults, Importance, IsArgumentOptional, Opt, Order,
ParserDirectives, Priority, Signature, Suggestion as MetadataSuggestion, Template,
};
use galaxy_util::path::ShellFamily;
use super::{TEST_ALIAS_COMMAND, TEST_GENERATOR_1_COMMAND, TEST_GENERATOR_2_COMMAND};
@@ -2,11 +2,11 @@
//! `galaxy_completer::signatures::CommandSignature`s, as well as `IntoWarpJs` implementations for
//! Rust structs that may be passed to JS functions defined on the Command Signature (e.g.
//! `GeneratorCompletionContext`).
use rquickjs::{FromJs, Function, Object, Value};
use galaxy_js::{
util::{get_one_or_more_optional, get_one_or_more_required, get_optional, get_required},
FromWarpJs, IntoWarpJs, JsFunctionRegistry,
};
use rquickjs::{FromJs, Function, Object, Value};
use super::{
Argument, ArgumentValue, Command, CommandSignature, GeneratorCompletionContext, GeneratorFn,
@@ -14,8 +14,8 @@ use std::cmp::Ordering;
pub use lookup::*;
pub use registry::*;
use serde::{Deserialize, Serialize};
use galaxy_js::TypedJsFunctionRef;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "test-util", derive(Default))]