declare const LINT_RULE_SET_SCHEMA_VERSION: 1; type LintSeverity = "error" | "warning"; interface ImportBindingPattern { readonly source: string; readonly imported: readonly string[]; } interface ImportSourcePattern { readonly value: string; readonly match: "exact" | "prefix"; } interface RequiredResultCheckPrimitive { readonly kind: "required-result-check"; readonly factories: readonly ImportBindingPattern[]; readonly guardProperty: string; readonly valueProperty: string; } type WrapperContext = "jsx-child" | "numeric-operation"; interface JsxWrapper { readonly syntax: "jsx"; readonly source: string; readonly imported: string; readonly prop: string; } interface CallWrapper { readonly syntax: "call"; readonly imports: readonly ImportBindingPattern[]; } interface RequiredWrapperCallPrimitive { readonly kind: "required-wrapper-call"; readonly context: WrapperContext; /** The rule is inactive unless the file imports one of these modules. */ readonly activationImports: readonly ImportSourcePattern[]; /** * Regular-expression source matched case-insensitively against both the raw identifier/property * name and a camelCase/PascalCase form normalized to lowercase snake_case. */ readonly subjectNamePattern: string; readonly wrapper: JsxWrapper | CallWrapper; readonly operators?: readonly string[]; } type BannedImportSource = ImportSourcePattern; interface BannedImportPrimitive { readonly kind: "banned-import"; readonly sources: readonly BannedImportSource[]; } interface BannedCallArgumentPrimitive { readonly kind: "banned-call-argument"; /** Unqualified callee names, such as the platform globals `fetch` and `Request`. */ readonly callees: readonly string[]; /** Ignore locally-bound functions and member calls that merely share a callee name. */ readonly globalCalleesOnly?: boolean; /** Zero-based argument positions to inspect. */ readonly argumentIndexes: readonly number[]; /** Direct object-property paths rejected inside a selected argument. */ readonly objectPaths: readonly (readonly string[])[]; readonly caseInsensitive?: boolean; } interface BannedJsxElementPrimitive { readonly kind: "banned-jsx-element"; readonly elements: readonly string[]; } interface ClassNameReplacement { readonly from: string; readonly to: string; } interface BannedClassNamePatternPrimitive { readonly kind: "banned-classname-pattern"; /** Regular-expression sources tested against a utility without variants, importance, or opacity. */ readonly patterns: readonly string[]; /** Exact terminal-token substitutions; variant prefixes are preserved. */ readonly replacements?: readonly ClassNameReplacement[]; } type LintPrimitive = RequiredResultCheckPrimitive | RequiredWrapperCallPrimitive | BannedImportPrimitive | BannedCallArgumentPrimitive | BannedJsxElementPrimitive | BannedClassNamePatternPrimitive; interface WrapJsxExpressionFix { readonly kind: "wrap-jsx-expression"; } interface ReplaceClassNameFix { readonly kind: "replace-classname"; } interface RemoveObjectPropertyFix { readonly kind: "remove-object-property"; } type LintFixDeclaration = WrapJsxExpressionFix | ReplaceClassNameFix | RemoveObjectPropertyFix; /** * Serializable rule contract shared by the SDK package and lint runners. * Rules contain data only; execution stays in the CLI so storefronts never * pull parser dependencies into their runtime bundles. */ interface LintRule { readonly id: string; readonly severity: LintSeverity; readonly message: string; readonly help: string; readonly primitive: LintPrimitive; readonly fix?: LintFixDeclaration; } interface LintRuleSet { readonly schemaVersion: typeof LINT_RULE_SET_SCHEMA_VERSION; readonly name: string; readonly rules: readonly LintRule[]; } /** Type-preserving helper for project-defined declarative lint rules. */ declare function defineLintRule(rule: Rule): Rule; /** Type-preserving helper for a versioned collection of declarative rules. */ declare function defineLintRuleSet(options: { readonly name: string; readonly rules: Rules; }): LintRuleSet & { readonly rules: Rules; }; declare const checkResultOkRule: { readonly id: "sdk/check-result-ok"; readonly severity: "error"; readonly message: "Check `result.ok` before reading `result.value`."; readonly help: "Cimplify SDK calls return Result values. Handle the error branch before using the value."; readonly primitive: { readonly kind: "required-result-check"; readonly factories: readonly [{ readonly source: "@cimplify/sdk"; readonly imported: readonly ["createCimplifyClient"]; }, { readonly source: "@cimplify/sdk/server"; readonly imported: readonly ["getServerClient"]; }]; readonly guardProperty: "ok"; readonly valueProperty: "value"; }; }; declare const renderPriceComponentRule: { readonly id: "sdk/render-price-component"; readonly severity: "error"; readonly message: "Render money with the SDK `Price` component."; readonly help: "`Price` applies the active business currency and locale consistently."; readonly primitive: { readonly kind: "required-wrapper-call"; readonly context: "jsx-child"; readonly activationImports: readonly [{ readonly value: "@cimplify/sdk"; readonly match: "prefix"; }]; readonly subjectNamePattern: "(?:^|_)(?:price|amount|subtotal|total|tax|fee|discount|cost)$"; readonly wrapper: { readonly syntax: "jsx"; readonly source: "@cimplify/sdk/react"; readonly imported: "Price"; readonly prop: "amount"; }; }; readonly fix: { readonly kind: "wrap-jsx-expression"; }; }; declare const parsePriceBeforeMathRule: { readonly id: "sdk/parse-price-before-math"; readonly severity: "error"; readonly message: "Call `parsePrice` before using a money value in numeric operations."; readonly help: "Money arrives over the wire as a decimal string; implicit coercion can produce incorrect comparisons and totals."; readonly primitive: { readonly kind: "required-wrapper-call"; readonly context: "numeric-operation"; readonly activationImports: readonly [{ readonly value: "@cimplify/sdk"; readonly match: "prefix"; }]; readonly subjectNamePattern: "(?:^|_)(?:price|amount|subtotal|total|tax|fee|discount|cost)$"; readonly wrapper: { readonly syntax: "call"; readonly imports: readonly [{ readonly source: "@cimplify/sdk"; readonly imported: readonly ["parsePrice"]; }, { readonly source: "@cimplify/sdk/utils"; readonly imported: readonly ["parsePrice"]; }]; }; readonly operators: readonly ["+", "-", "*", "/", "%", "**", "<", "<=", ">", ">="]; }; }; declare const noReactQueryRule: { readonly id: "sdk/no-react-query"; readonly severity: "error"; readonly message: "Use Cimplify SDK hooks instead of React Query."; readonly help: "Use the SDK hooks and their provider-owned cache so cart, catalogue, and account state stay coherent."; readonly primitive: { readonly kind: "banned-import"; readonly sources: readonly [{ readonly value: "react-query"; readonly match: "exact"; }, { readonly value: "@tanstack/react-query"; readonly match: "prefix"; }]; }; }; declare const noCookieInCacheKeyRule: { readonly id: "sdk/no-cookie-in-cache-key"; readonly severity: "error"; readonly message: "Remove the Cookie header from this cacheable request."; readonly help: "Cookie-bearing requests bypass the shared cache by design. Keep personalized cart/account reads in a client island."; readonly primitive: { readonly kind: "banned-call-argument"; readonly callees: readonly ["fetch", "Request"]; readonly globalCalleesOnly: true; readonly argumentIndexes: readonly [1]; readonly objectPaths: readonly [readonly ["headers", "cookie"]]; readonly caseInsensitive: true; }; readonly fix: { readonly kind: "remove-object-property"; }; }; declare const noRawImgRule: { readonly id: "ui/no-raw-img"; readonly severity: "warning"; readonly message: "Use `next/image` instead of a raw `` element."; readonly help: "The storefront image loader supplies responsive sizes, modern formats, and intrinsic dimensions."; readonly primitive: { readonly kind: "banned-jsx-element"; readonly elements: readonly ["img"]; }; }; declare const themeTokensOnlyRule: { readonly id: "ui/theme-tokens-only"; readonly severity: "warning"; readonly message: "Use storefront theme tokens instead of hard-coded color utilities."; readonly help: "Define palette changes in `app/globals.css` and consume semantic utilities such as `bg-background` and `text-foreground`."; readonly primitive: { readonly kind: "banned-classname-pattern"; readonly patterns: readonly ["^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950)$", "^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-(?:black|white)$", "^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-\\[(?:#|rgba?\\(|hsla?\\(|oklch\\(|oklab\\(|lab\\(|lch\\(|color:)"]; readonly replacements: readonly [{ readonly from: "bg-white"; readonly to: "bg-background"; }, { readonly from: "bg-black"; readonly to: "bg-foreground"; }, { readonly from: "text-black"; readonly to: "text-foreground"; }, { readonly from: "border-black"; readonly to: "border-foreground"; }, { readonly from: "border-white"; readonly to: "border-background"; }]; }; readonly fix: { readonly kind: "replace-classname"; }; }; /** * v1 deliberately excludes `sdk/not-found-only-on-code`: reliable data-flow * analysis for that rule needs a later semantic pass rather than a heuristic. */ declare const starterLintRuleSet: LintRuleSet & { readonly rules: readonly [{ readonly id: "sdk/check-result-ok"; readonly severity: "error"; readonly message: "Check `result.ok` before reading `result.value`."; readonly help: "Cimplify SDK calls return Result values. Handle the error branch before using the value."; readonly primitive: { readonly kind: "required-result-check"; readonly factories: readonly [{ readonly source: "@cimplify/sdk"; readonly imported: readonly ["createCimplifyClient"]; }, { readonly source: "@cimplify/sdk/server"; readonly imported: readonly ["getServerClient"]; }]; readonly guardProperty: "ok"; readonly valueProperty: "value"; }; }, { readonly id: "sdk/render-price-component"; readonly severity: "error"; readonly message: "Render money with the SDK `Price` component."; readonly help: "`Price` applies the active business currency and locale consistently."; readonly primitive: { readonly kind: "required-wrapper-call"; readonly context: "jsx-child"; readonly activationImports: readonly [{ readonly value: "@cimplify/sdk"; readonly match: "prefix"; }]; readonly subjectNamePattern: "(?:^|_)(?:price|amount|subtotal|total|tax|fee|discount|cost)$"; readonly wrapper: { readonly syntax: "jsx"; readonly source: "@cimplify/sdk/react"; readonly imported: "Price"; readonly prop: "amount"; }; }; readonly fix: { readonly kind: "wrap-jsx-expression"; }; }, { readonly id: "sdk/parse-price-before-math"; readonly severity: "error"; readonly message: "Call `parsePrice` before using a money value in numeric operations."; readonly help: "Money arrives over the wire as a decimal string; implicit coercion can produce incorrect comparisons and totals."; readonly primitive: { readonly kind: "required-wrapper-call"; readonly context: "numeric-operation"; readonly activationImports: readonly [{ readonly value: "@cimplify/sdk"; readonly match: "prefix"; }]; readonly subjectNamePattern: "(?:^|_)(?:price|amount|subtotal|total|tax|fee|discount|cost)$"; readonly wrapper: { readonly syntax: "call"; readonly imports: readonly [{ readonly source: "@cimplify/sdk"; readonly imported: readonly ["parsePrice"]; }, { readonly source: "@cimplify/sdk/utils"; readonly imported: readonly ["parsePrice"]; }]; }; readonly operators: readonly ["+", "-", "*", "/", "%", "**", "<", "<=", ">", ">="]; }; }, { readonly id: "sdk/no-react-query"; readonly severity: "error"; readonly message: "Use Cimplify SDK hooks instead of React Query."; readonly help: "Use the SDK hooks and their provider-owned cache so cart, catalogue, and account state stay coherent."; readonly primitive: { readonly kind: "banned-import"; readonly sources: readonly [{ readonly value: "react-query"; readonly match: "exact"; }, { readonly value: "@tanstack/react-query"; readonly match: "prefix"; }]; }; }, { readonly id: "sdk/no-cookie-in-cache-key"; readonly severity: "error"; readonly message: "Remove the Cookie header from this cacheable request."; readonly help: "Cookie-bearing requests bypass the shared cache by design. Keep personalized cart/account reads in a client island."; readonly primitive: { readonly kind: "banned-call-argument"; readonly callees: readonly ["fetch", "Request"]; readonly globalCalleesOnly: true; readonly argumentIndexes: readonly [1]; readonly objectPaths: readonly [readonly ["headers", "cookie"]]; readonly caseInsensitive: true; }; readonly fix: { readonly kind: "remove-object-property"; }; }, { readonly id: "ui/no-raw-img"; readonly severity: "warning"; readonly message: "Use `next/image` instead of a raw `` element."; readonly help: "The storefront image loader supplies responsive sizes, modern formats, and intrinsic dimensions."; readonly primitive: { readonly kind: "banned-jsx-element"; readonly elements: readonly ["img"]; }; }, { readonly id: "ui/theme-tokens-only"; readonly severity: "warning"; readonly message: "Use storefront theme tokens instead of hard-coded color utilities."; readonly help: "Define palette changes in `app/globals.css` and consume semantic utilities such as `bg-background` and `text-foreground`."; readonly primitive: { readonly kind: "banned-classname-pattern"; readonly patterns: readonly ["^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950)$", "^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-(?:black|white)$", "^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-\\[(?:#|rgba?\\(|hsla?\\(|oklch\\(|oklab\\(|lab\\(|lch\\(|color:)"]; readonly replacements: readonly [{ readonly from: "bg-white"; readonly to: "bg-background"; }, { readonly from: "bg-black"; readonly to: "bg-foreground"; }, { readonly from: "text-black"; readonly to: "text-foreground"; }, { readonly from: "border-black"; readonly to: "border-foreground"; }, { readonly from: "border-white"; readonly to: "border-background"; }]; }; readonly fix: { readonly kind: "replace-classname"; }; }]; }; declare const starterLintRules: readonly LintRule[] & readonly [{ readonly id: "sdk/check-result-ok"; readonly severity: "error"; readonly message: "Check `result.ok` before reading `result.value`."; readonly help: "Cimplify SDK calls return Result values. Handle the error branch before using the value."; readonly primitive: { readonly kind: "required-result-check"; readonly factories: readonly [{ readonly source: "@cimplify/sdk"; readonly imported: readonly ["createCimplifyClient"]; }, { readonly source: "@cimplify/sdk/server"; readonly imported: readonly ["getServerClient"]; }]; readonly guardProperty: "ok"; readonly valueProperty: "value"; }; }, { readonly id: "sdk/render-price-component"; readonly severity: "error"; readonly message: "Render money with the SDK `Price` component."; readonly help: "`Price` applies the active business currency and locale consistently."; readonly primitive: { readonly kind: "required-wrapper-call"; readonly context: "jsx-child"; readonly activationImports: readonly [{ readonly value: "@cimplify/sdk"; readonly match: "prefix"; }]; readonly subjectNamePattern: "(?:^|_)(?:price|amount|subtotal|total|tax|fee|discount|cost)$"; readonly wrapper: { readonly syntax: "jsx"; readonly source: "@cimplify/sdk/react"; readonly imported: "Price"; readonly prop: "amount"; }; }; readonly fix: { readonly kind: "wrap-jsx-expression"; }; }, { readonly id: "sdk/parse-price-before-math"; readonly severity: "error"; readonly message: "Call `parsePrice` before using a money value in numeric operations."; readonly help: "Money arrives over the wire as a decimal string; implicit coercion can produce incorrect comparisons and totals."; readonly primitive: { readonly kind: "required-wrapper-call"; readonly context: "numeric-operation"; readonly activationImports: readonly [{ readonly value: "@cimplify/sdk"; readonly match: "prefix"; }]; readonly subjectNamePattern: "(?:^|_)(?:price|amount|subtotal|total|tax|fee|discount|cost)$"; readonly wrapper: { readonly syntax: "call"; readonly imports: readonly [{ readonly source: "@cimplify/sdk"; readonly imported: readonly ["parsePrice"]; }, { readonly source: "@cimplify/sdk/utils"; readonly imported: readonly ["parsePrice"]; }]; }; readonly operators: readonly ["+", "-", "*", "/", "%", "**", "<", "<=", ">", ">="]; }; }, { readonly id: "sdk/no-react-query"; readonly severity: "error"; readonly message: "Use Cimplify SDK hooks instead of React Query."; readonly help: "Use the SDK hooks and their provider-owned cache so cart, catalogue, and account state stay coherent."; readonly primitive: { readonly kind: "banned-import"; readonly sources: readonly [{ readonly value: "react-query"; readonly match: "exact"; }, { readonly value: "@tanstack/react-query"; readonly match: "prefix"; }]; }; }, { readonly id: "sdk/no-cookie-in-cache-key"; readonly severity: "error"; readonly message: "Remove the Cookie header from this cacheable request."; readonly help: "Cookie-bearing requests bypass the shared cache by design. Keep personalized cart/account reads in a client island."; readonly primitive: { readonly kind: "banned-call-argument"; readonly callees: readonly ["fetch", "Request"]; readonly globalCalleesOnly: true; readonly argumentIndexes: readonly [1]; readonly objectPaths: readonly [readonly ["headers", "cookie"]]; readonly caseInsensitive: true; }; readonly fix: { readonly kind: "remove-object-property"; }; }, { readonly id: "ui/no-raw-img"; readonly severity: "warning"; readonly message: "Use `next/image` instead of a raw `` element."; readonly help: "The storefront image loader supplies responsive sizes, modern formats, and intrinsic dimensions."; readonly primitive: { readonly kind: "banned-jsx-element"; readonly elements: readonly ["img"]; }; }, { readonly id: "ui/theme-tokens-only"; readonly severity: "warning"; readonly message: "Use storefront theme tokens instead of hard-coded color utilities."; readonly help: "Define palette changes in `app/globals.css` and consume semantic utilities such as `bg-background` and `text-foreground`."; readonly primitive: { readonly kind: "banned-classname-pattern"; readonly patterns: readonly ["^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-(?:slate|gray|zinc|neutral|stone|red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose)-(?:50|100|200|300|400|500|600|700|800|900|950)$", "^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-(?:black|white)$", "^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|placeholder|ring|shadow|stroke|text|to|via)-\\[(?:#|rgba?\\(|hsla?\\(|oklch\\(|oklab\\(|lab\\(|lch\\(|color:)"]; readonly replacements: readonly [{ readonly from: "bg-white"; readonly to: "bg-background"; }, { readonly from: "bg-black"; readonly to: "bg-foreground"; }, { readonly from: "text-black"; readonly to: "text-foreground"; }, { readonly from: "border-black"; readonly to: "border-foreground"; }, { readonly from: "border-white"; readonly to: "border-background"; }]; }; readonly fix: { readonly kind: "replace-classname"; }; }]; /** Maximum UTF-8 size accepted for one inert lint-rule manifest. */ declare const MAX_LINT_RULE_MANIFEST_BYTES: number; /** Validate and freeze one declarative rule at the SDK authoring boundary. */ declare function validateLintRule(value: unknown): LintRule; /** * Validate and freeze a complete data-only rule manifest. * * This is the single contract used by SDK authoring/build and every runner, * so a rule release cannot publish data that the CLI will later reject. */ declare function validateLintRuleSet(value: unknown): LintRuleSet; export { type BannedCallArgumentPrimitive, type BannedClassNamePatternPrimitive, type BannedImportPrimitive, type BannedImportSource, type BannedJsxElementPrimitive, type CallWrapper, type ClassNameReplacement, type ImportBindingPattern, type ImportSourcePattern, type JsxWrapper, LINT_RULE_SET_SCHEMA_VERSION, type LintFixDeclaration, type LintPrimitive, type LintRule, type LintRuleSet, type LintSeverity, MAX_LINT_RULE_MANIFEST_BYTES, type RemoveObjectPropertyFix, type ReplaceClassNameFix, type RequiredResultCheckPrimitive, type RequiredWrapperCallPrimitive, type WrapJsxExpressionFix, type WrapperContext, checkResultOkRule, defineLintRule, defineLintRuleSet, noCookieInCacheKeyRule, noRawImgRule, noReactQueryRule, parsePriceBeforeMathRule, renderPriceComponentRule, starterLintRuleSet, starterLintRules, themeTokensOnlyRule, validateLintRule, validateLintRuleSet };