MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / parseDeleteRuleInput

Function parseDeleteRuleInput

src/core/webview/rulesMessageHandler.ts:145–162  ·  view source on GitHub ↗
(message: WebviewMessage)

Source from the content-addressed store, hash-verified

143}
144
145function parseDeleteRuleInput(message: WebviewMessage): DeleteRuleInput {
146 const values = message.values ?? {}
147 const scope = parseRuleScope(values.scope)
148 const kind = parseRuleKind(values.kind)
149 const relativePath = values.relativePath ?? message.text
150
151 if (!scope || !kind || !relativePath) {
152 throw new Error("Missing required fields: scope, kind, or relativePath")
153 }
154
155 return {
156 id: typeof values.id === "string" ? values.id : undefined,
157 scope,
158 kind,
159 modeSlug: typeof values.modeSlug === "string" ? values.modeSlug : undefined,
160 relativePath,
161 }
162}
163
164function parseRuleScope(value: unknown): RuleScope | undefined {
165 return value === "global" || value === "project" ? value : undefined

Callers 2

handleDeleteRuleFunction · 0.85
handleOpenRuleFileFunction · 0.85

Calls 2

parseRuleScopeFunction · 0.85
parseRuleKindFunction · 0.85

Tested by

no test coverage detected