Skip to content

Commit 14e83a9

Browse files
committed
feat: support env section in config yaml
1 parent 4b51607 commit 14e83a9

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

gui/src/components/mainInput/Lump/EditBlockButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { IdeMessengerContext } from "../../../context/IdeMessenger";
66

77
type SectionKey = Exclude<
88
keyof ConfigYaml,
9-
"name" | "version" | "schema" | "metadata"
9+
"name" | "version" | "schema" | "metadata" | "env"
1010
>;
1111

1212
interface EditBlockButtonProps<T extends SectionKey> {
@@ -42,10 +42,10 @@ export default function EditBlockButton<T extends SectionKey>({
4242
element: { sourceFile },
4343
});
4444
} else if (block && isUsesBlock(block)) {
45-
openUrl(`${block.uses}/new-version`);
45+
void openUrl(`${block.uses}/new-version`);
4646
} else if (selectedProfile?.fullSlug) {
4747
const slug = `${selectedProfile.fullSlug.ownerSlug}/${selectedProfile.fullSlug.packageSlug}`;
48-
openUrl(`${slug}/new-version`);
48+
void openUrl(`${slug}/new-version`);
4949
}
5050
};
5151

packages/config-yaml/src/load/merge.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export function mergePackages(
1313
rules: [...(current.rules ?? []), ...(incoming.rules ?? [])],
1414
prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
1515
docs: [...(current.docs ?? []), ...(incoming.docs ?? [])],
16+
env: { ...current.env, ...incoming.env },
1617
};
1718
}
1819

@@ -29,5 +30,6 @@ export function mergeUnrolledAssistants(
2930
data: [...(current.data ?? []), ...(incoming.data ?? [])],
3031
mcpServers: [...(current.mcpServers ?? []), ...(incoming.mcpServers ?? [])],
3132
prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
33+
env: { ...current.env, ...incoming.env },
3234
};
3335
}

packages/config-yaml/src/load/unroll.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export async function unrollBlocks(
321321

322322
const sections: (keyof Omit<
323323
ConfigYaml,
324-
"name" | "version" | "rules" | "schema" | "metadata"
324+
"name" | "version" | "rules" | "schema" | "metadata" | "env"
325325
>)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
326326

327327
// Process all sections in parallel

packages/config-yaml/src/schemas/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,17 @@ export const commonMetadataSchema = z.object({
105105
iconUrl: z.string().optional(),
106106
});
107107

108+
const envRecord = z.record(
109+
z.string(),
110+
z.union([z.string(), z.number(), z.boolean()]),
111+
);
112+
108113
export const baseConfigYamlSchema = z.object({
109114
name: z.string(),
110115
version: z.string(),
111116
schema: z.string().optional(),
112117
metadata: z.record(z.string()).and(commonMetadataSchema.partial()).optional(),
118+
env: envRecord.optional(),
113119
});
114120

115121
const modelsUsesSchema = z
@@ -254,6 +260,7 @@ export const configSchema = z.object({
254260
proxy: z.string().optional(),
255261
api_base: z.string().optional(),
256262
api_key: z.string().optional(),
263+
env: envRecord.optional(),
257264
});
258265

259266
export type Config = z.infer<typeof configSchema>;

0 commit comments

Comments
 (0)