import type { SkillsCompiledRule } from './skillsLock'; export const SKILLS_LOCK_COMPILER_VERSION = '1.0.0'; export type SkillsRuleTemplate = Omit; export type SkillsCompilerTemplate = { name: string; description: string; rules: ReadonlyArray; }; export const skillsCompilerTemplates: Record = { 'ios-guidelines': { name: 'ios-guidelines', description: 'Curated enforcement mapping for iOS skill baseline.', rules: [ { id: 'skills.ios.no-force-unwrap', description: 'Disallow force unwrap in production iOS code.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', locked: true, }, { id: 'skills.ios.no-force-try', description: 'Disallow force try in production iOS code.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', locked: true, }, { id: 'skills.ios.no-anyview', description: 'Disallow AnyView in production iOS code.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', locked: true, }, { id: 'skills.ios.no-callback-style-outside-bridges', description: 'Disallow callback-style signatures outside approved iOS bridge layers.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-force-cast', description: 'Disallow force cast in production iOS code.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', locked: true, }, ], }, 'ios-concurrency-guidelines': { name: 'ios-concurrency-guidelines', description: 'Curated enforcement mapping for Swift Concurrency references (actors, isolation, Sendable, tasks).', rules: [ { id: 'skills.ios.no-dispatchqueue', description: 'Avoid DispatchQueue in production iOS code; prefer structured concurrency.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-dispatchgroup', description: 'Avoid DispatchGroup in production iOS code; prefer TaskGroup.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-dispatchsemaphore', description: 'Avoid DispatchSemaphore in production iOS code.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-operation-queue', description: 'Avoid OperationQueue in production iOS code unless explicitly justified.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-task-detached', description: 'Avoid Task.detached in production iOS code without strict isolation rationale.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-async-without-await', description: 'Avoid private async functions without await; remove async unless a protocol or override boundary requires it.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-unchecked-sendable', description: 'Avoid @unchecked Sendable in production iOS code without strict safety invariant.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-preconcurrency', description: 'Avoid @preconcurrency in production iOS code without a documented safety invariant and a removal ticket.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-nonisolated-unsafe', description: 'Avoid nonisolated(unsafe) in production iOS code without a documented safety invariant and a removal ticket.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-assume-isolated', description: 'Avoid assumeIsolated in production iOS code; prefer explicit actor isolation or await MainActor.run.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, ], }, 'ios-swiftui-expert-guidelines': { name: 'ios-swiftui-expert-guidelines', description: 'Curated enforcement mapping for SwiftUI expert references (state, modern APIs, performance).', rules: [ { id: 'skills.ios.no-observable-object', description: 'Avoid ObservableObject in modern iOS code; prefer @Observable where available.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-legacy-swiftui-observable-wrapper', description: 'Avoid @StateObject and @ObservedObject in modern SwiftUI code paths that can adopt @Observable with @State/@Bindable.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-passed-value-state-wrapper', description: 'Avoid storing values injected from a parent as @State or @StateObject; prefer let, @Binding, or owned @State created locally.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-navigation-view', description: 'Avoid NavigationView in modern iOS code; prefer NavigationStack.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-foreground-color', description: 'Avoid foregroundColor in modern SwiftUI code; prefer foregroundStyle.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-corner-radius', description: 'Avoid cornerRadius in modern SwiftUI code; prefer clipShape(.rect(cornerRadius:)).', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-tab-item', description: 'Avoid tabItem in modern SwiftUI code paths that can adopt the new Tab API.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-on-tap-gesture', description: 'Avoid onTapGesture for button-like interactions in production iOS code.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-string-format', description: 'Avoid String(format:) in SwiftUI presentation code; prefer modern formatting APIs.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-foreach-indices', description: 'Avoid ForEach over .indices in dynamic SwiftUI content; prefer stable element identity or explicit stable IDs.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-contains-user-filter', description: 'Avoid contains() in user-facing filter flows; prefer localizedStandardContains() for SwiftUI search text matching.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-geometryreader', description: 'Avoid GeometryReader in modern SwiftUI layout code when containerRelativeFrame(), visualEffect(), or simpler layout APIs are enough.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-font-weight-bold', description: 'Avoid fontWeight(.bold) in SwiftUI text styling; prefer bold() for straightforward emphasis.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-scrollview-shows-indicators', description: 'Avoid ScrollView(showsIndicators: false) in SwiftUI code; prefer scrollIndicators(.hidden).', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-sheet-is-presented', description: 'Avoid .sheet(isPresented:) in SwiftUI presentation flows; prefer .sheet(item:) when possible.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-legacy-onchange', description: 'Avoid legacy single-parameter onChange in modern SwiftUI code; prefer modern overloads.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-uiscreen-main-bounds', description: 'Avoid UIScreen.main.bounds in SwiftUI layout code; prefer relative layout APIs.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, ], }, 'ios-swift-testing-guidelines': { name: 'ios-swift-testing-guidelines', description: 'Curated enforcement mapping for Swift Testing adoption in iOS unit and integration tests.', rules: [ { id: 'skills.ios.prefer-swift-testing', description: 'Prefer Swift Testing over XCTest-only unit and integration tests, including suites that can migrate to import Testing and @Test.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-xctassert', description: 'Avoid XCTest assertion macros in modern Swift tests; prefer #expect.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-xctunwrap', description: 'Avoid XCTUnwrap in modern Swift tests; prefer #require.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-wait-for-expectations', description: 'Avoid wait(for:) and waitForExpectations(timeout:) in async iOS tests; prefer await fulfillment(of:).', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-legacy-expectation-description', description: 'Avoid expectation(description:) scaffolding without modern fulfillment or confirmation flow in iOS tests.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-mixed-testing-frameworks', description: 'Avoid mixing XCTestCase suites with Swift Testing markers in the same iOS test file without explicit compatibility reason.', severity: 'WARN', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, ], }, 'ios-core-data-guidelines': { name: 'ios-core-data-guidelines', description: 'Curated enforcement mapping for Core Data boundaries across layers, contexts, and async APIs.', rules: [ { id: 'skills.ios.no-nsmanagedobject-boundary', description: 'Avoid NSManagedObject in shared function and property boundaries; prefer object IDs or mapped models.', severity: 'WARN', platform: 'ios', confidence: 'MEDIUM', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-nsmanagedobject-async-boundary', description: 'Avoid NSManagedObject in async function boundaries; prefer object IDs or mapped models.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-core-data-layer-leak', description: 'Keep Core Data orchestration inside infrastructure or repository layers; avoid Core Data APIs in application or presentation code.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.ios.no-nsmanagedobject-state-leak', description: 'Avoid leaking context-scoped NSManagedObject instances into SwiftUI state or view models; prefer object IDs or mapped models.', severity: 'ERROR', platform: 'ios', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, ], }, 'backend-guidelines': { name: 'backend-guidelines', description: 'Curated enforcement mapping for backend skill baseline.', rules: [ { id: 'skills.backend.no-empty-catch', description: 'Disallow empty catch blocks in backend runtime code.', severity: 'CRITICAL', platform: 'backend', confidence: 'HIGH', locked: true, }, { id: 'skills.backend.no-console-log', description: 'Disallow console.log in backend runtime code.', severity: 'ERROR', platform: 'backend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.backend.avoid-explicit-any', description: 'Avoid explicit any in backend runtime code.', severity: 'WARN', platform: 'backend', confidence: 'MEDIUM', stage: 'PRE_COMMIT', locked: true, }, { id: 'skills.backend.no-solid-violations', description: 'Disallow backend SOLID violations in production code.', severity: 'ERROR', platform: 'backend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.backend.enforce-clean-architecture', description: 'Enforce clean architecture dependency direction in backend code.', severity: 'ERROR', platform: 'backend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.backend.no-god-classes', description: 'Disallow god classes in backend code.', severity: 'ERROR', platform: 'backend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, ], }, 'frontend-guidelines': { name: 'frontend-guidelines', description: 'Curated enforcement mapping for frontend skill baseline.', rules: [ { id: 'skills.frontend.no-console-log', description: 'Disallow console.log in frontend production code.', severity: 'ERROR', platform: 'frontend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.frontend.no-empty-catch', description: 'Disallow empty catch blocks in frontend runtime code.', severity: 'ERROR', platform: 'frontend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.frontend.avoid-explicit-any', description: 'Avoid explicit any in frontend runtime code.', severity: 'WARN', platform: 'frontend', confidence: 'MEDIUM', stage: 'PRE_COMMIT', locked: true, }, { id: 'skills.frontend.no-solid-violations', description: 'Disallow frontend SOLID violations in production code.', severity: 'ERROR', platform: 'frontend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.frontend.enforce-clean-architecture', description: 'Enforce clean architecture dependency direction in frontend code.', severity: 'ERROR', platform: 'frontend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.frontend.no-god-classes', description: 'Disallow god classes in frontend code.', severity: 'ERROR', platform: 'frontend', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, ], }, 'android-guidelines': { name: 'android-guidelines', description: 'Curated enforcement mapping for Android skill baseline.', rules: [ { id: 'skills.android.no-thread-sleep', description: 'Disallow Thread.sleep in Android production code.', severity: 'ERROR', platform: 'android', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.android.no-globalscope', description: 'Disallow GlobalScope in Android production code.', severity: 'ERROR', platform: 'android', confidence: 'HIGH', stage: 'PRE_PUSH', locked: true, }, { id: 'skills.android.no-runblocking', description: 'Disallow runBlocking in Android production code.', severity: 'WARN', platform: 'android', confidence: 'MEDIUM', stage: 'PRE_COMMIT', locked: true, }, ], }, };