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

Function normalizeSlugEffect

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

Source from the content-addressed store, hash-verified

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

Callers 2

createFunction · 0.85
updateFunction · 0.85

Calls 1

slugifyFunction · 0.70

Tested by

no test coverage detected