MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / normalizeSlugEffect

Function normalizeSlugEffect

packages/plugins/toolkits/src/server.ts:102–116  ·  view source on GitHub ↗
(input: {
  readonly name: string;
  readonly slug?: string;
})

Source from the content-addressed store, hash-verified

100 .slice(0, 63);
101
102const normalizeSlugEffect = (input: {
103 readonly name: string;
104 readonly slug?: string;
105}): Effect.Effect<string, ToolkitError> => {
106 const slug = (input.slug ?? slugify(input.name)).trim().toLowerCase();
107 if (!slugPattern.test(slug)) {
108 return Effect.fail(
109 new ToolkitError({
110 message:
111 "Toolkit slug must be 1-63 lowercase letters, numbers, or hyphens, and cannot start or end with a hyphen.",
112 }),
113 );
114 }
115 return Effect.succeed(slug);
116};
117
118const fail = (message: string): Effect.Effect<never, ToolkitError> =>
119 Effect.fail(new ToolkitError({ message }));

Callers 2

createFunction · 0.85
updateFunction · 0.85

Calls 1

slugifyFunction · 0.70

Tested by

no test coverage detected