Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e482810328 | ||
|
|
86aa0b7539 | ||
|
|
c7bc4421c5 | ||
|
|
a496dc4865 |
@@ -25,7 +25,6 @@ jobs:
|
|||||||
- run: pnpm run typecheck
|
- run: pnpm run typecheck
|
||||||
- run: pnpm run format:check
|
- run: pnpm run format:check
|
||||||
- run: pnpm run test
|
- run: pnpm run test
|
||||||
- run: pnpm run build
|
|
||||||
|
|
||||||
- name: Set package version from the tag
|
- name: Set package version from the tag
|
||||||
run: npm pkg set version="${GITHUB_REF_NAME#v}"
|
run: npm pkg set version="${GITHUB_REF_NAME#v}"
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ Type-specific fields:
|
|||||||
| `string` | `text` (or `password` if `secret: true`) | `textarea` (needs `multiline: true`), `password` |
|
| `string` | `text` (or `password` if `secret: true`) | `textarea` (needs `multiline: true`), `password` |
|
||||||
| `number` | `number` | `slider` (requires both `min` and `max`) |
|
| `number` | `number` | `slider` (requires both `min` and `max`) |
|
||||||
| `boolean` | `checkbox` | `switch` |
|
| `boolean` | `checkbox` | `switch` |
|
||||||
| `enum` | `select` | `radio` |
|
| `enum` | `select` | `radio`, `combobox` (searchable, single-select) |
|
||||||
| `multiselect` | `multiselect` (combobox) | `checkboxGroup` |
|
| `multiselect` | `multiselect` (combobox) | `checkboxGroup` |
|
||||||
|
|
||||||
### `passAs` semantics
|
### `passAs` semantics
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Check, ChevronsUpDown } from "lucide-react";
|
||||||
|
import { buttonVariants } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
CommandList,
|
||||||
|
} from "@/components/ui/command";
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from "@/components/ui/popover";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
interface ComboboxProps {
|
||||||
|
choices: string[];
|
||||||
|
value: string;
|
||||||
|
onChange: (value: string) => void;
|
||||||
|
placeholder?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Combobox({
|
||||||
|
choices,
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
placeholder = "Select...",
|
||||||
|
}: ComboboxProps) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
|
<PopoverTrigger
|
||||||
|
className={cn(
|
||||||
|
buttonVariants({ variant: "outline" }),
|
||||||
|
"h-auto min-h-8 w-full justify-between font-normal",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className={cn("flex-1 text-left", !value && "text-muted-foreground")}
|
||||||
|
>
|
||||||
|
{value || placeholder}
|
||||||
|
</span>
|
||||||
|
<ChevronsUpDown className="text-muted-foreground size-4 shrink-0" />
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-80 p-0">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="Search..." />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty>No matches.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{choices.map((choice) => (
|
||||||
|
<CommandItem
|
||||||
|
key={choice}
|
||||||
|
onSelect={() => {
|
||||||
|
onChange(choice);
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 size-4",
|
||||||
|
value === choice ? "opacity-100" : "opacity-0",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{choice}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
import { Slider } from "@/components/ui/slider";
|
import { Slider } from "@/components/ui/slider";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { MultiSelect } from "./controls/multi-select";
|
import { MultiSelect } from "./controls/multi-select";
|
||||||
|
import { Combobox } from "./controls/combobox";
|
||||||
import type { ClientVariable } from "@/lib/config/serialize";
|
import type { ClientVariable } from "@/lib/config/serialize";
|
||||||
|
|
||||||
export function FieldRenderer({ variable }: { variable: ClientVariable }) {
|
export function FieldRenderer({ variable }: { variable: ClientVariable }) {
|
||||||
@@ -211,6 +212,29 @@ export function FieldRenderer({ variable }: { variable: ClientVariable }) {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
case "combobox":
|
||||||
|
return (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>
|
||||||
|
{label}
|
||||||
|
{variable.required && (
|
||||||
|
<span className="text-destructive"> *</span>
|
||||||
|
)}
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Combobox
|
||||||
|
choices={variable.type === "enum" ? variable.choices : []}
|
||||||
|
value={field.value ?? ""}
|
||||||
|
onChange={(value) => field.onChange(value)}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
{variable.description && (
|
||||||
|
<FormDescription>{variable.description}</FormDescription>
|
||||||
|
)}
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
);
|
||||||
|
|
||||||
case "radio":
|
case "radio":
|
||||||
return (
|
return (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const controlSchema = z.enum([
|
|||||||
"switch",
|
"switch",
|
||||||
"select",
|
"select",
|
||||||
"radio",
|
"radio",
|
||||||
|
"combobox",
|
||||||
"multiselect",
|
"multiselect",
|
||||||
"checkboxGroup",
|
"checkboxGroup",
|
||||||
]);
|
]);
|
||||||
@@ -115,6 +116,13 @@ const variableWithChecks = variableSchema.superRefine((variable, ctx) => {
|
|||||||
path: ["control"],
|
path: ["control"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (variable.control === "combobox" && variable.type !== "enum") {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: "custom",
|
||||||
|
message: "control 'combobox' requires type 'enum'",
|
||||||
|
path: ["control"],
|
||||||
|
});
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
variable.control === "slider" &&
|
variable.control === "slider" &&
|
||||||
variable.type === "number" &&
|
variable.type === "number" &&
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export function buildInvocation(
|
|||||||
const argv = [...script.args];
|
const argv = [...script.args];
|
||||||
const env: Record<string, string> = {};
|
const env: Record<string, string> = {};
|
||||||
const redactedArgv = [...script.args];
|
const redactedArgv = [...script.args];
|
||||||
|
const redactedEnvAssignments: string[] = [];
|
||||||
const redactedVariables: Record<string, unknown> = {};
|
const redactedVariables: Record<string, unknown> = {};
|
||||||
|
|
||||||
for (const variable of script.variables) {
|
for (const variable of script.variables) {
|
||||||
@@ -55,6 +56,9 @@ export function buildInvocation(
|
|||||||
case "env": {
|
case "env": {
|
||||||
const value = stringifyValue(raw, variable.joinWith);
|
const value = stringifyValue(raw, variable.joinWith);
|
||||||
env[variable.envName!] = value;
|
env[variable.envName!] = value;
|
||||||
|
redactedEnvAssignments.push(
|
||||||
|
`${variable.envName}=${variable.secret ? REDACTED : value}`,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "stdin": {
|
case "stdin": {
|
||||||
@@ -74,7 +78,11 @@ export function buildInvocation(
|
|||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const redactedCommandLine = [script.command, ...redactedArgv].join(" ");
|
const redactedCommandLine = [
|
||||||
|
...redactedEnvAssignments,
|
||||||
|
script.command,
|
||||||
|
...redactedArgv,
|
||||||
|
].join(" ");
|
||||||
|
|
||||||
return { argv, env, stdin, redactedVariables, redactedCommandLine };
|
return { argv, env, stdin, redactedVariables, redactedCommandLine };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user