Skip to content

Commit e7f1ca3

Browse files
seefeldbclaude
andcommitted
refactor: Remove unnecessary recipe name parameters
Remove recipe name parameters throughout the codebase where the names don't add meaningful value. Names were mostly duplicating information already available from the file name or [NAME] symbol. Changes: - built-in.ts: Removed type parameter, use type inference - opaque-ref.ts: Removed "mapping function" name from internal map - Multiple pattern files: Removed redundant names, use inline types Files updated: - array-in-cell-ast-nocomponents, charm-ref-in-cell, charms-ref-in-cell - cheeseboard, common-tools, counter, ct-render, dice - instantiate-recipe, linkedlist-in-cell, llm, nested-counter, output_schema All patterns still function identically using the more concise function-only syntax. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cd659d4 commit e7f1ca3

15 files changed

+16
-17
lines changed

packages/patterns/array-in-cell-ast-nocomponents.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const addItem = handler<InputEventType, ListState>(
2626
},
2727
);
2828

29-
export default recipe<InputSchema>("Simple List", ({ title, items }) => {
29+
export default recipe(({ title, items }: InputSchema) => {
3030
return {
3131
[NAME]: title,
3232
[UI]: (

packages/patterns/charm-ref-in-cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type RecipeInOutput = {
3131
};
3232

3333
// the simple charm (to which we'll store a reference within a cell)
34-
const SimpleRecipe = recipe<{ id: string }>("Simple Recipe", ({ id }) => ({
34+
const SimpleRecipe = recipe(({ id }: { id: string }) => ({
3535
[NAME]: derive(id, (idValue) => `SimpleRecipe: ${idValue}`),
3636
[UI]: <div>Simple Recipe id {id}</div>,
3737
}));

packages/patterns/charms-ref-in-cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface AddCharmState {
2929
const AddCharmSchema = toSchema<AddCharmState>();
3030

3131
// Simple charm that will be instantiated multiple times
32-
const SimpleRecipe = recipe<{ id: string }>("Simple Recipe", ({ id }) => ({
32+
const SimpleRecipe = recipe(({ id }: { id: string }) => ({
3333
[NAME]: derive(id, (idValue) => `SimpleRecipe: ${idValue}`),
3434
[UI]: <div>Simple Recipe id {id}</div>,
3535
}));

packages/patterns/cheeseboard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const createPizzaListCell = lift<{ result: WebReadResult }, CheeseboardEntry[]>(
8282
},
8383
);
8484

85-
export default recipe("Cheeseboard", () => {
85+
export default recipe(() => {
8686
const cheeseBoardUrl =
8787
"https://cheeseboardcollective.coop/home/pizza/pizza-schedule/";
8888
const { result } = fetchData<WebReadResult>({

packages/patterns/common-tools.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ type ToolsInput = {
179179
list: ListItem[];
180180
};
181181

182-
export default recipe<ToolsInput>("Tools", ({ list }) => {
182+
export default recipe(({ list }: ToolsInput) => {
183183
const tools: Record<string, BuiltInLLMTool> = {
184184
search_web: {
185185
pattern: searchWeb,

packages/patterns/counter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface RecipeOutput {
1212
decrement: Stream<void>;
1313
}
1414

15-
export default recipe<RecipeState, RecipeOutput>("Counter", (state) => {
15+
export default recipe((state: RecipeState) => {
1616
return {
1717
[NAME]: str`Simple counter: ${state.value}`,
1818
[UI]: (

packages/patterns/ct-render.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function nth(value: number) {
3333
return `${value}th`;
3434
}
3535

36-
export const Counter = recipe<RecipeState>("Counter", (state) => {
36+
export const Counter = recipe((state: RecipeState) => {
3737
return {
3838
// str is used so we can directly interpolate the OpaqueRef<number> into the string
3939
[NAME]: str`Simple counter: ${state.value}`,
@@ -59,7 +59,7 @@ export const Counter = recipe<RecipeState>("Counter", (state) => {
5959
};
6060
});
6161

62-
export default recipe<RecipeState>("Counter", (state) => {
62+
export default recipe((state: RecipeState) => {
6363
const counter = Counter({ value: state.value });
6464

6565
return {

packages/patterns/dice.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface RecipeOutput {
1414
roll: Stream<{ sides?: number }>;
1515
}
1616

17-
export default recipe<RecipeState, RecipeOutput>("Dice", (state) => {
17+
export default recipe((state: RecipeState) => {
1818
return {
1919
[NAME]: `Dice Roller`,
2020
[UI]: (

packages/patterns/instantiate-recipe.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function nth(value: number) {
3939
return `${value}th`;
4040
}
4141

42-
export const Counter = recipe<RecipeState>("Counter", (state) => {
42+
export const Counter = recipe((state: RecipeState) => {
4343
return {
4444
[NAME]: str`Simple counter: ${state.value}`,
4545
[UI]: (

packages/patterns/linkedlist-in-cell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const addItem = handler<InputEventType, ListState>(
5555
},
5656
);
5757

58-
export default recipe("Simple LinkedList", ({ title }: InputSchema) => {
58+
export default recipe(({ title }: InputSchema) => {
5959
const items_list = cell<LinkedList>({ value: "1" });
6060

6161
// Create a derived value for the linked list string representation

0 commit comments

Comments
 (0)