diff --git a/crates/pdk-api/src/api/mod.rs b/crates/pdk-api/src/api/mod.rs index babd6ff89..3325996bc 100644 --- a/crates/pdk-api/src/api/mod.rs +++ b/crates/pdk-api/src/api/mod.rs @@ -284,13 +284,6 @@ api_struct!( pub struct ExecutableConfig { /// The file to execute, relative from the tool directory. /// Does *not* support virtual paths. - /// - /// The following scenarios are powered by this field: - /// - Is the primary executable. - /// - For primary and secondary bins, the source file to be symlinked, - /// and the extension to use for the symlink file itself. - /// - For primary shim, this field is ignored. - /// - For secondary shims, the file to execute. #[serde(skip_serializing_if = "Option::is_none")] pub exe_path: Option, @@ -311,6 +304,10 @@ api_struct!( #[serde(skip_serializing_if = "Option::is_none")] pub parent_exe_name: Option, + /// Whether this is the primary executable or not. + #[serde(skip_serializing_if = "is_false")] + pub primary: bool, + /// Custom args to prepend to user-provided args within the generated shim. #[serde(skip_serializing_if = "Option::is_none")] pub shim_before_args: Option, @@ -333,6 +330,14 @@ impl ExecutableConfig { } } + pub fn new_primary>(exe_path: T) -> Self { + Self { + exe_path: Some(PathBuf::from(exe_path.as_ref())), + primary: true, + ..ExecutableConfig::default() + } + } + pub fn with_parent, P: AsRef>(exe_path: T, parent_exe: P) -> Self { Self { exe_path: Some(PathBuf::from(exe_path.as_ref())), @@ -346,8 +351,14 @@ api_struct!( /// Output returned by the `locate_executables` function. #[serde(default)] pub struct LocateExecutablesOutput { + /// Configures executable information to be used as proto bins/shims. + /// The map key will be the name of the executable file. + #[serde(skip_serializing_if = "FxHashMap::is_empty")] + pub exes: FxHashMap, + /// Relative directory path from the tool install directory in which - /// pre-installed executables can be located. + /// pre-installed executables can be located. This directory path + /// will be used during `proto active`, but not for bins/shims. #[serde(skip_serializing_if = "Option::is_none")] pub exes_dir: Option, @@ -363,11 +374,13 @@ api_struct!( /// Configures the primary/default executable to create. /// If not provided, a primary shim and binary will *not* be created. + #[deprecated(note = "Use `exes` instead.")] #[serde(skip_serializing_if = "Option::is_none")] pub primary: Option, /// Configures secondary/additional executables to create. /// The map key is the name of the shim/binary file. + #[deprecated(note = "Use `exes` instead.")] #[serde(skip_serializing_if = "FxHashMap::is_empty")] pub secondary: FxHashMap, } diff --git a/package/src/api-types.ts b/package/src/api-types.ts index 13244afa3..7cd43d680 100644 --- a/package/src/api-types.ts +++ b/package/src/api-types.ts @@ -264,13 +264,6 @@ export interface ExecutableConfig { /** * The file to execute, relative from the tool directory. * Does *not* support virtual paths. - * - * The following scenarios are powered by this field: - * - Is the primary executable. - * - For primary and secondary bins, the source file to be symlinked, - * and the extension to use for the symlink file itself. - * - For primary shim, this field is ignored. - * - For secondary shims, the file to execute. */ exePath?: string | null; /** Do not symlink a binary in `~/.proto/bin`. */ @@ -279,6 +272,8 @@ export interface ExecutableConfig { noShim?: boolean; /** The parent executable name required to execute the local executable path. */ parentExeName?: string | null; + /** Whether this is the primary executable or not. */ + primary?: boolean; /** Custom args to append to user-provided args within the generated shim. */ shimAfterArgs?: StringOrVec | null; /** Custom args to prepend to user-provided args within the generated shim. */ @@ -289,9 +284,15 @@ export interface ExecutableConfig { /** Output returned by the `locate_executables` function. */ export interface LocateExecutablesOutput { + /** + * Configures executable information to be used as proto bins/shims. + * The map key will be the name of the executable file. + */ + exes?: Record; /** * Relative directory path from the tool install directory in which - * pre-installed executables can be located. + * pre-installed executables can be located. This directory path + * will be used during `proto active`, but not for bins/shims. */ exesDir?: string | null; /** diff --git a/registry/data/third-party.json b/registry/data/third-party.json index 914be5446..15b036001 100644 --- a/registry/data/third-party.json +++ b/registry/data/third-party.json @@ -689,7 +689,7 @@ "name": "openfga", "description": "OpenFGA is an open-source authorization solution that allows developers to build granular access control.", "author": "crashdump", - "homepageUrl": "https://openfga.dev", + "homepageUrl": "https://openfga.dev/", "repositoryUrl": "https://github.com/crashdump/proto-tools", "bins": [ "openfga" @@ -826,14 +826,14 @@ "sops" ] }, - { + { "id": "staticcheck", "locator": "https://raw.githubusercontent.com/crashdump/proto-tools/main/toml-plugins/staticcheck/plugin.toml", "format": "toml", "name": "staticcheck", "description": "Staticcheck is a state of the art linter for the Go programming language. Using static analysis, it finds bugs and performance issues, offers simplifications, and enforces style rules.", "author": "crashdump", - "homepageUrl": "https://staticcheck.dev", + "homepageUrl": "https://staticcheck.dev/", "repositoryUrl": "https://github.com/crashdump/proto-tools", "bins": [ "staticcheck" diff --git a/registry/schema.json b/registry/schema.json index ec95aa23c..7b6319f92 100644 --- a/registry/schema.json +++ b/registry/schema.json @@ -188,8 +188,10 @@ "description": "Format of the plugin.", "type": "string", "enum": [ + "json", "toml", - "wasm" + "wasm", + "yaml" ] }, "PluginLocator": {