@cregis-dev/cckit 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +54 -53
  2. package/registry.json +116 -92
  3. package/src/cli.js +2 -2
  4. package/src/steps/configure-user.js +23 -8
  5. package/src/steps/install-rules.js +11 -52
  6. package/templates/rules/README.md +103 -0
  7. package/templates/rules/common/agents.md +49 -0
  8. package/templates/rules/common/coding-style.md +48 -0
  9. package/templates/rules/common/development-workflow.md +37 -0
  10. package/templates/rules/common/git-workflow.md +24 -0
  11. package/templates/rules/common/hooks.md +30 -0
  12. package/templates/rules/common/patterns.md +31 -0
  13. package/templates/rules/common/performance.md +55 -0
  14. package/templates/rules/common/security.md +29 -0
  15. package/templates/rules/common/testing.md +29 -0
  16. package/templates/rules/golang/coding-style.md +32 -0
  17. package/templates/rules/golang/hooks.md +17 -0
  18. package/templates/rules/golang/patterns.md +45 -0
  19. package/templates/rules/golang/security.md +34 -0
  20. package/templates/rules/golang/testing.md +31 -0
  21. package/templates/rules/python/coding-style.md +42 -0
  22. package/templates/rules/python/hooks.md +19 -0
  23. package/templates/rules/python/patterns.md +39 -0
  24. package/templates/rules/python/security.md +30 -0
  25. package/templates/rules/python/testing.md +38 -0
  26. package/templates/rules/swift/coding-style.md +47 -0
  27. package/templates/rules/swift/hooks.md +20 -0
  28. package/templates/rules/swift/patterns.md +66 -0
  29. package/templates/rules/swift/security.md +33 -0
  30. package/templates/rules/swift/testing.md +45 -0
  31. package/templates/rules/typescript/coding-style.md +65 -0
  32. package/templates/rules/typescript/hooks.md +22 -0
  33. package/templates/rules/typescript/patterns.md +52 -0
  34. package/templates/rules/typescript/security.md +28 -0
  35. package/templates/rules/typescript/testing.md +18 -0
@@ -0,0 +1,20 @@
1
+ ---
2
+ paths:
3
+ - "**/*.swift"
4
+ - "**/Package.swift"
5
+ ---
6
+ # Swift Hooks
7
+
8
+ > This file extends [common/hooks.md](../common/hooks.md) with Swift specific content.
9
+
10
+ ## PostToolUse Hooks
11
+
12
+ Configure in `~/.claude/settings.json`:
13
+
14
+ - **SwiftFormat**: Auto-format `.swift` files after edit
15
+ - **SwiftLint**: Run lint checks after editing `.swift` files
16
+ - **swift build**: Type-check modified packages after edit
17
+
18
+ ## Warning
19
+
20
+ Flag `print()` statements — use `os.Logger` or structured logging instead for production code.
@@ -0,0 +1,66 @@
1
+ ---
2
+ paths:
3
+ - "**/*.swift"
4
+ - "**/Package.swift"
5
+ ---
6
+ # Swift Patterns
7
+
8
+ > This file extends [common/patterns.md](../common/patterns.md) with Swift specific content.
9
+
10
+ ## Protocol-Oriented Design
11
+
12
+ Define small, focused protocols. Use protocol extensions for shared defaults:
13
+
14
+ ```swift
15
+ protocol Repository: Sendable {
16
+ associatedtype Item: Identifiable & Sendable
17
+ func find(by id: Item.ID) async throws -> Item?
18
+ func save(_ item: Item) async throws
19
+ }
20
+ ```
21
+
22
+ ## Value Types
23
+
24
+ - Use structs for data transfer objects and models
25
+ - Use enums with associated values to model distinct states:
26
+
27
+ ```swift
28
+ enum LoadState<T: Sendable>: Sendable {
29
+ case idle
30
+ case loading
31
+ case loaded(T)
32
+ case failed(Error)
33
+ }
34
+ ```
35
+
36
+ ## Actor Pattern
37
+
38
+ Use actors for shared mutable state instead of locks or dispatch queues:
39
+
40
+ ```swift
41
+ actor Cache<Key: Hashable & Sendable, Value: Sendable> {
42
+ private var storage: [Key: Value] = [:]
43
+
44
+ func get(_ key: Key) -> Value? { storage[key] }
45
+ func set(_ key: Key, value: Value) { storage[key] = value }
46
+ }
47
+ ```
48
+
49
+ ## Dependency Injection
50
+
51
+ Inject protocols with default parameters — production uses defaults, tests inject mocks:
52
+
53
+ ```swift
54
+ struct UserService {
55
+ private let repository: any UserRepository
56
+
57
+ init(repository: any UserRepository = DefaultUserRepository()) {
58
+ self.repository = repository
59
+ }
60
+ }
61
+ ```
62
+
63
+ ## References
64
+
65
+ See skill: `swift-actor-persistence` for actor-based persistence patterns.
66
+ See skill: `swift-protocol-di-testing` for protocol-based DI and testing.
@@ -0,0 +1,33 @@
1
+ ---
2
+ paths:
3
+ - "**/*.swift"
4
+ - "**/Package.swift"
5
+ ---
6
+ # Swift Security
7
+
8
+ > This file extends [common/security.md](../common/security.md) with Swift specific content.
9
+
10
+ ## Secret Management
11
+
12
+ - Use **Keychain Services** for sensitive data (tokens, passwords, keys) — never `UserDefaults`
13
+ - Use environment variables or `.xcconfig` files for build-time secrets
14
+ - Never hardcode secrets in source — decompilation tools extract them trivially
15
+
16
+ ```swift
17
+ let apiKey = ProcessInfo.processInfo.environment["API_KEY"]
18
+ guard let apiKey, !apiKey.isEmpty else {
19
+ fatalError("API_KEY not configured")
20
+ }
21
+ ```
22
+
23
+ ## Transport Security
24
+
25
+ - App Transport Security (ATS) is enforced by default — do not disable it
26
+ - Use certificate pinning for critical endpoints
27
+ - Validate all server certificates
28
+
29
+ ## Input Validation
30
+
31
+ - Sanitize all user input before display to prevent injection
32
+ - Use `URL(string:)` with validation rather than force-unwrapping
33
+ - Validate data from external sources (APIs, deep links, pasteboard) before processing
@@ -0,0 +1,45 @@
1
+ ---
2
+ paths:
3
+ - "**/*.swift"
4
+ - "**/Package.swift"
5
+ ---
6
+ # Swift Testing
7
+
8
+ > This file extends [common/testing.md](../common/testing.md) with Swift specific content.
9
+
10
+ ## Framework
11
+
12
+ Use **Swift Testing** (`import Testing`) for new tests. Use `@Test` and `#expect`:
13
+
14
+ ```swift
15
+ @Test("User creation validates email")
16
+ func userCreationValidatesEmail() throws {
17
+ #expect(throws: ValidationError.invalidEmail) {
18
+ try User(email: "not-an-email")
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Test Isolation
24
+
25
+ Each test gets a fresh instance — set up in `init`, tear down in `deinit`. No shared mutable state between tests.
26
+
27
+ ## Parameterized Tests
28
+
29
+ ```swift
30
+ @Test("Validates formats", arguments: ["json", "xml", "csv"])
31
+ func validatesFormat(format: String) throws {
32
+ let parser = try Parser(format: format)
33
+ #expect(parser.isValid)
34
+ }
35
+ ```
36
+
37
+ ## Coverage
38
+
39
+ ```bash
40
+ swift test --enable-code-coverage
41
+ ```
42
+
43
+ ## Reference
44
+
45
+ See skill: `swift-protocol-di-testing` for protocol-based dependency injection and mock patterns with Swift Testing.
@@ -0,0 +1,65 @@
1
+ ---
2
+ paths:
3
+ - "**/*.ts"
4
+ - "**/*.tsx"
5
+ - "**/*.js"
6
+ - "**/*.jsx"
7
+ ---
8
+ # TypeScript/JavaScript Coding Style
9
+
10
+ > This file extends [common/coding-style.md](../common/coding-style.md) with TypeScript/JavaScript specific content.
11
+
12
+ ## Immutability
13
+
14
+ Use spread operator for immutable updates:
15
+
16
+ ```typescript
17
+ // WRONG: Mutation
18
+ function updateUser(user, name) {
19
+ user.name = name // MUTATION!
20
+ return user
21
+ }
22
+
23
+ // CORRECT: Immutability
24
+ function updateUser(user, name) {
25
+ return {
26
+ ...user,
27
+ name
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Error Handling
33
+
34
+ Use async/await with try-catch:
35
+
36
+ ```typescript
37
+ try {
38
+ const result = await riskyOperation()
39
+ return result
40
+ } catch (error) {
41
+ console.error('Operation failed:', error)
42
+ throw new Error('Detailed user-friendly message')
43
+ }
44
+ ```
45
+
46
+ ## Input Validation
47
+
48
+ Use Zod for schema-based validation:
49
+
50
+ ```typescript
51
+ import { z } from 'zod'
52
+
53
+ const schema = z.object({
54
+ email: z.string().email(),
55
+ age: z.number().int().min(0).max(150)
56
+ })
57
+
58
+ const validated = schema.parse(input)
59
+ ```
60
+
61
+ ## Console.log
62
+
63
+ - No `console.log` statements in production code
64
+ - Use proper logging libraries instead
65
+ - See hooks for automatic detection
@@ -0,0 +1,22 @@
1
+ ---
2
+ paths:
3
+ - "**/*.ts"
4
+ - "**/*.tsx"
5
+ - "**/*.js"
6
+ - "**/*.jsx"
7
+ ---
8
+ # TypeScript/JavaScript Hooks
9
+
10
+ > This file extends [common/hooks.md](../common/hooks.md) with TypeScript/JavaScript specific content.
11
+
12
+ ## PostToolUse Hooks
13
+
14
+ Configure in `~/.claude/settings.json`:
15
+
16
+ - **Prettier**: Auto-format JS/TS files after edit
17
+ - **TypeScript check**: Run `tsc` after editing `.ts`/`.tsx` files
18
+ - **console.log warning**: Warn about `console.log` in edited files
19
+
20
+ ## Stop Hooks
21
+
22
+ - **console.log audit**: Check all modified files for `console.log` before session ends
@@ -0,0 +1,52 @@
1
+ ---
2
+ paths:
3
+ - "**/*.ts"
4
+ - "**/*.tsx"
5
+ - "**/*.js"
6
+ - "**/*.jsx"
7
+ ---
8
+ # TypeScript/JavaScript Patterns
9
+
10
+ > This file extends [common/patterns.md](../common/patterns.md) with TypeScript/JavaScript specific content.
11
+
12
+ ## API Response Format
13
+
14
+ ```typescript
15
+ interface ApiResponse<T> {
16
+ success: boolean
17
+ data?: T
18
+ error?: string
19
+ meta?: {
20
+ total: number
21
+ page: number
22
+ limit: number
23
+ }
24
+ }
25
+ ```
26
+
27
+ ## Custom Hooks Pattern
28
+
29
+ ```typescript
30
+ export function useDebounce<T>(value: T, delay: number): T {
31
+ const [debouncedValue, setDebouncedValue] = useState<T>(value)
32
+
33
+ useEffect(() => {
34
+ const handler = setTimeout(() => setDebouncedValue(value), delay)
35
+ return () => clearTimeout(handler)
36
+ }, [value, delay])
37
+
38
+ return debouncedValue
39
+ }
40
+ ```
41
+
42
+ ## Repository Pattern
43
+
44
+ ```typescript
45
+ interface Repository<T> {
46
+ findAll(filters?: Filters): Promise<T[]>
47
+ findById(id: string): Promise<T | null>
48
+ create(data: CreateDto): Promise<T>
49
+ update(id: string, data: UpdateDto): Promise<T>
50
+ delete(id: string): Promise<void>
51
+ }
52
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ paths:
3
+ - "**/*.ts"
4
+ - "**/*.tsx"
5
+ - "**/*.js"
6
+ - "**/*.jsx"
7
+ ---
8
+ # TypeScript/JavaScript Security
9
+
10
+ > This file extends [common/security.md](../common/security.md) with TypeScript/JavaScript specific content.
11
+
12
+ ## Secret Management
13
+
14
+ ```typescript
15
+ // NEVER: Hardcoded secrets
16
+ const apiKey = "sk-proj-xxxxx"
17
+
18
+ // ALWAYS: Environment variables
19
+ const apiKey = process.env.OPENAI_API_KEY
20
+
21
+ if (!apiKey) {
22
+ throw new Error('OPENAI_API_KEY not configured')
23
+ }
24
+ ```
25
+
26
+ ## Agent Support
27
+
28
+ - Use **security-reviewer** skill for comprehensive security audits
@@ -0,0 +1,18 @@
1
+ ---
2
+ paths:
3
+ - "**/*.ts"
4
+ - "**/*.tsx"
5
+ - "**/*.js"
6
+ - "**/*.jsx"
7
+ ---
8
+ # TypeScript/JavaScript Testing
9
+
10
+ > This file extends [common/testing.md](../common/testing.md) with TypeScript/JavaScript specific content.
11
+
12
+ ## E2E Testing
13
+
14
+ Use **Playwright** as the E2E testing framework for critical user flows.
15
+
16
+ ## Agent Support
17
+
18
+ - **e2e-runner** - Playwright E2E testing specialist