crucible-mcp 0.5.0__py3-none-any.whl → 1.0.1__py3-none-any.whl

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 (47) hide show
  1. crucible/cli.py +109 -2
  2. crucible/enforcement/bundled/error-handling.yaml +84 -0
  3. crucible/enforcement/bundled/security.yaml +123 -0
  4. crucible/enforcement/bundled/smart-contract.yaml +110 -0
  5. crucible/enforcement/compliance.py +9 -5
  6. crucible/hooks/claudecode.py +388 -0
  7. crucible/hooks/precommit.py +117 -25
  8. crucible/knowledge/loader.py +186 -0
  9. crucible/knowledge/principles/API_DESIGN.md +176 -0
  10. crucible/knowledge/principles/COMMITS.md +127 -0
  11. crucible/knowledge/principles/DATABASE.md +138 -0
  12. crucible/knowledge/principles/DOCUMENTATION.md +201 -0
  13. crucible/knowledge/principles/ERROR_HANDLING.md +157 -0
  14. crucible/knowledge/principles/FP.md +162 -0
  15. crucible/knowledge/principles/GITIGNORE.md +218 -0
  16. crucible/knowledge/principles/OBSERVABILITY.md +147 -0
  17. crucible/knowledge/principles/PRECOMMIT.md +201 -0
  18. crucible/knowledge/principles/SECURITY.md +136 -0
  19. crucible/knowledge/principles/SMART_CONTRACT.md +153 -0
  20. crucible/knowledge/principles/SYSTEM_DESIGN.md +153 -0
  21. crucible/knowledge/principles/TESTING.md +129 -0
  22. crucible/knowledge/principles/TYPE_SAFETY.md +170 -0
  23. crucible/skills/accessibility-engineer/SKILL.md +71 -0
  24. crucible/skills/backend-engineer/SKILL.md +69 -0
  25. crucible/skills/customer-success/SKILL.md +69 -0
  26. crucible/skills/data-engineer/SKILL.md +70 -0
  27. crucible/skills/devops-engineer/SKILL.md +69 -0
  28. crucible/skills/fde-engineer/SKILL.md +69 -0
  29. crucible/skills/formal-verification/SKILL.md +86 -0
  30. crucible/skills/gas-optimizer/SKILL.md +89 -0
  31. crucible/skills/incident-responder/SKILL.md +91 -0
  32. crucible/skills/mev-researcher/SKILL.md +87 -0
  33. crucible/skills/mobile-engineer/SKILL.md +70 -0
  34. crucible/skills/performance-engineer/SKILL.md +68 -0
  35. crucible/skills/product-engineer/SKILL.md +68 -0
  36. crucible/skills/protocol-architect/SKILL.md +83 -0
  37. crucible/skills/security-engineer/SKILL.md +63 -0
  38. crucible/skills/tech-lead/SKILL.md +92 -0
  39. crucible/skills/uiux-engineer/SKILL.md +70 -0
  40. crucible/skills/web3-engineer/SKILL.md +79 -0
  41. crucible_mcp-1.0.1.dist-info/METADATA +198 -0
  42. crucible_mcp-1.0.1.dist-info/RECORD +66 -0
  43. crucible_mcp-0.5.0.dist-info/METADATA +0 -161
  44. crucible_mcp-0.5.0.dist-info/RECORD +0 -30
  45. {crucible_mcp-0.5.0.dist-info → crucible_mcp-1.0.1.dist-info}/WHEEL +0 -0
  46. {crucible_mcp-0.5.0.dist-info → crucible_mcp-1.0.1.dist-info}/entry_points.txt +0 -0
  47. {crucible_mcp-0.5.0.dist-info → crucible_mcp-1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,201 @@
1
+ ---
2
+ name: Documentation
3
+ description: Code comments, READMEs, API docs, architecture docs
4
+ triggers: [docs, documentation, readme, comments]
5
+ type: preference
6
+ ---
7
+
8
+ # Documentation Principles
9
+
10
+ What to document, where to put it, and how to keep it useful.
11
+
12
+ ---
13
+
14
+ ## The Docs Folder
15
+
16
+ ```
17
+ docs/
18
+ ├── FEATURES.md # What the project does (capabilities)
19
+ ├── ROADMAP.md # What's planned (timeline + status)
20
+ ├── ARCHITECTURE.md # How it works (diagrams + data flow)
21
+ └── design-*.md # Decision docs for specific features
22
+ ```
23
+
24
+ ---
25
+
26
+ ## FEATURES.md
27
+
28
+ Complete reference for all capabilities.
29
+
30
+ ```markdown
31
+ # Project Features
32
+
33
+ ## Overview
34
+ [ASCII diagram showing the system]
35
+
36
+ ## Feature Category 1
37
+
38
+ ### Feature A
39
+ - What it does
40
+ - How to use it
41
+ - Configuration options
42
+
43
+ ### Feature B
44
+ ...
45
+
46
+ ## CLI Commands
47
+ | Command | Purpose |
48
+ |---------|---------|
49
+ | `cmd list` | List items |
50
+ | `cmd add` | Add item |
51
+ ```
52
+
53
+ ---
54
+
55
+ ## ROADMAP.md
56
+
57
+ Version timeline and planned features.
58
+
59
+ ```markdown
60
+ # Roadmap
61
+
62
+ ## Current: vX.Y (Month Year)
63
+
64
+ ### What's Shipped
65
+ | Feature | Status | Notes |
66
+ |---------|--------|-------|
67
+ | Feature A | Done | Details |
68
+ | Feature B | Done | Details |
69
+
70
+ ## vX.Z (Planned)
71
+
72
+ ### Focus: Theme
73
+ | Feature | Description |
74
+ |---------|-------------|
75
+ | Feature C | What it will do |
76
+
77
+ ## Version History
78
+ | Version | Date | Highlights |
79
+ |---------|------|------------|
80
+ | v1.0 | Jan 2026 | Initial release |
81
+ ```
82
+
83
+ ---
84
+
85
+ ## ARCHITECTURE.md
86
+
87
+ System design and data flow.
88
+
89
+ ```markdown
90
+ # Architecture
91
+
92
+ ## Overview
93
+ [ASCII or Mermaid diagram]
94
+
95
+ ## Components
96
+ | Component | Purpose |
97
+ |-----------|---------|
98
+ | api/ | HTTP handlers |
99
+ | core/ | Business logic |
100
+
101
+ ## Data Flow
102
+ [Sequence diagram]
103
+
104
+ ## File Structure
105
+ ```
106
+ src/
107
+ ├── api/ # HTTP layer
108
+ ├── core/ # Business logic
109
+ └── db/ # Database access
110
+ ```
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Design Docs
116
+
117
+ For significant decisions:
118
+
119
+ ```markdown
120
+ # Design: Feature Name
121
+
122
+ ## Context
123
+ What problem are we solving?
124
+
125
+ ## Options Considered
126
+ 1. **Option A**: Pros/cons
127
+ 2. **Option B**: Pros/cons
128
+
129
+ ## Decision
130
+ We chose Option A because...
131
+
132
+ ## Consequences
133
+ - Positive: X
134
+ - Negative: Y
135
+ - Neutral: Z
136
+ ```
137
+
138
+ ---
139
+
140
+ ## README.md
141
+
142
+ Quick start only:
143
+
144
+ ```markdown
145
+ # Project Name
146
+
147
+ One-line description.
148
+
149
+ ## Quick Start
150
+ \`\`\`bash
151
+ pip install project
152
+ project init
153
+ \`\`\`
154
+
155
+ ## Documentation
156
+ - [Features](docs/FEATURES.md)
157
+ - [Architecture](docs/ARCHITECTURE.md)
158
+ - [Roadmap](docs/ROADMAP.md)
159
+ ```
160
+
161
+ ---
162
+
163
+ ## CLAUDE.md
164
+
165
+ Project context for AI assistants:
166
+
167
+ ```markdown
168
+ # Project Name
169
+
170
+ Brief description.
171
+
172
+ ## Quick Reference
173
+ \`\`\`bash
174
+ command1 # What it does
175
+ command2 # What it does
176
+ \`\`\`
177
+
178
+ ## Project Structure
179
+ [Concise overview]
180
+
181
+ ## Patterns
182
+ [Code conventions used]
183
+
184
+ ## Development
185
+ [How to run/test]
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Keep Docs Current
191
+
192
+ ```
193
+ - Update FEATURES.md when shipping
194
+ - Update ROADMAP.md when planning
195
+ - Update ARCHITECTURE.md on major changes
196
+ - Review quarterly for staleness
197
+ ```
198
+
199
+ ---
200
+
201
+ *Template. Adapt structure to your project size.*
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: Error Handling
3
+ description: Result types, error boundaries, no silent failures
4
+ triggers: [errors, exceptions, error-handling, try-catch]
5
+ type: principle
6
+ assertions: error-handling.yaml
7
+ ---
8
+
9
+ # Error Handling Principles
10
+
11
+ ---
12
+
13
+ ## Result Types
14
+
15
+ Return errors as values instead of throwing exceptions.
16
+
17
+ ```typescript
18
+ // Throwing (invisible control flow)
19
+ const getUser = (id: UserId): User => {
20
+ const user = db.find(id);
21
+ if (!user) throw new Error('Not found');
22
+ return user;
23
+ }
24
+
25
+ // Result type (explicit, type-safe)
26
+ type Result<T, E> = { ok: true; value: T } | { ok: false; error: E };
27
+
28
+ const getUser = (id: UserId): Result<User, 'NOT_FOUND' | 'DB_ERROR'> => {
29
+ try {
30
+ const user = db.find(id);
31
+ if (!user) return { ok: false, error: 'NOT_FOUND' };
32
+ return { ok: true, value: user };
33
+ } catch (e) {
34
+ return { ok: false, error: 'DB_ERROR' };
35
+ }
36
+ }
37
+ ```
38
+
39
+ ---
40
+
41
+ ## Caller Handles Errors
42
+
43
+ ```typescript
44
+ const result = await getUser(id);
45
+ if (!result.ok) {
46
+ // Handle error
47
+ return;
48
+ }
49
+ // result.value is typed as User
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Typed Errors
55
+
56
+ ```typescript
57
+ // String errors (no structure, no exhaustiveness checking)
58
+ throw new Error('Something went wrong');
59
+
60
+ // Typed errors (structured, exhaustive)
61
+ type TipError =
62
+ | { type: 'PAGE_NOT_FOUND' }
63
+ | { type: 'AMOUNT_TOO_SMALL'; minimum: Cents }
64
+ | { type: 'AMOUNT_TOO_LARGE'; maximum: Cents }
65
+ | { type: 'PAYMENT_FAILED'; reason: string };
66
+
67
+ const handleError = (error: TipError) => {
68
+ switch (error.type) {
69
+ case 'PAGE_NOT_FOUND':
70
+ return 'Page not found';
71
+ case 'AMOUNT_TOO_SMALL':
72
+ return `Minimum amount is ${error.minimum}`;
73
+ // TypeScript ensures all cases handled
74
+ }
75
+ };
76
+ ```
77
+
78
+ ---
79
+
80
+ ## When to Throw
81
+
82
+ Exceptions are for truly exceptional cases:
83
+
84
+ ```
85
+ Throw for:
86
+ ├── Out of memory
87
+ ├── Network unreachable
88
+ ├── Programmer errors (assertions, invariant violations)
89
+ ├── API boundaries (convert Result → HTTP status)
90
+
91
+ Return Result for:
92
+ ├── Business logic ("user not found" is expected)
93
+ ├── Validation errors
94
+ ├── Anything the caller should handle
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Python Pattern
100
+
101
+ ```python
102
+ from dataclasses import dataclass
103
+ from typing import Union
104
+
105
+ @dataclass(frozen=True)
106
+ class Ok[T]:
107
+ value: T
108
+
109
+ @dataclass(frozen=True)
110
+ class Err[E]:
111
+ error: E
112
+
113
+ Result = Union[Ok[T], Err[E]]
114
+
115
+ def get_user(user_id: str) -> Result[User, str]:
116
+ user = db.find(user_id)
117
+ if not user:
118
+ return Err("NOT_FOUND")
119
+ return Ok(user)
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Error Messages
125
+
126
+ ```typescript
127
+ // Vague
128
+ throw new Error('Failed');
129
+
130
+ // Actionable
131
+ throw new Error(`Failed to fetch user ${userId}: connection timeout after 5000ms`);
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Logging Errors
137
+
138
+ ```typescript
139
+ // Silent failure (avoid)
140
+ try {
141
+ await riskyOperation();
142
+ } catch (e) {
143
+ // nothing
144
+ }
145
+
146
+ // Log at minimum
147
+ try {
148
+ await riskyOperation();
149
+ } catch (e) {
150
+ log.error('riskyOperation failed', { error: e });
151
+ // Then decide: rethrow, return default, or return error
152
+ }
153
+ ```
154
+
155
+ ---
156
+
157
+ *Template. Adapt to your needs.*
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: Functional Programming
3
+ description: Immutability, pure functions, composition patterns
4
+ triggers: [functional, fp, immutable, pure-functions]
5
+ type: preference
6
+ ---
7
+
8
+ # Functional Programming Principles
9
+
10
+ ---
11
+
12
+ ## Core Concepts
13
+
14
+ ```
15
+ FP characteristics:
16
+ ├── Pure functions (same input → same output)
17
+ ├── Immutable data structures
18
+ ├── Functions as first-class values
19
+ ├── Composition over inheritance
20
+ └── Side effects isolated to boundaries
21
+
22
+ Use OOP when:
23
+ ├── Modeling stateful entities
24
+ ├── Complex state machines
25
+ ├── Framework requires it
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Pure Functions
31
+
32
+ Same input produces same output. No side effects.
33
+
34
+ ```typescript
35
+ // Pure: No state access, no external calls
36
+ function calculateFee(amount: Cents): Cents {
37
+ return Math.round(amount * 0.01) as Cents;
38
+ }
39
+
40
+ // Impure: Reads external state
41
+ function calculateFee(amount: Cents): Cents {
42
+ return Math.round(amount * config.feeRate) as Cents;
43
+ }
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Immutability
49
+
50
+ ```typescript
51
+ // Mutation (avoid)
52
+ const addItem = (items: Item[], newItem: Item) => {
53
+ items.push(newItem); // Mutates original
54
+ return items;
55
+ }
56
+
57
+ // Immutable (prefer)
58
+ const addItem = (items: Item[], newItem: Item): Item[] => {
59
+ return [...items, newItem]; // New array
60
+ }
61
+ ```
62
+
63
+ **In Python:**
64
+ ```python
65
+ @dataclass(frozen=True)
66
+ class User:
67
+ id: str
68
+ email: str
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Composition Over Inheritance
74
+
75
+ ```typescript
76
+ // Inheritance (rigid hierarchy)
77
+ class Animal { }
78
+ class Dog extends Animal { }
79
+ class ServiceDog extends Dog { }
80
+
81
+ // Composition (flexible)
82
+ const withLogging = (fn) => (...args) => {
83
+ console.log('Called with:', args);
84
+ return fn(...args);
85
+ };
86
+
87
+ const withRetry = (fn, attempts = 3) => async (...args) => {
88
+ for (let i = 0; i < attempts; i++) {
89
+ try { return await fn(...args); }
90
+ catch (e) { if (i === attempts - 1) throw e; }
91
+ }
92
+ };
93
+
94
+ // Compose behaviors
95
+ const resilientFetch = withRetry(withLogging(fetch));
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Functions vs Classes
101
+
102
+ ```typescript
103
+ // Class-based
104
+ class TipService {
105
+ private db: Database;
106
+ constructor(db: Database) { this.db = db; }
107
+ async createTip(data: TipData) { ... }
108
+ }
109
+
110
+ // Function-based
111
+ const createTip = (db: Database, data: TipData): Promise<Result<Tip, TipError>> => { ... }
112
+
113
+ // Factory for grouping related functions
114
+ const createTipService = (db: Database) => ({
115
+ create: (data: TipData) => createTip(db, data),
116
+ getByPage: (pageId: PageId) => getTipsByPage(db, pageId),
117
+ });
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Data Transformations
123
+
124
+ Pipelines over loops:
125
+
126
+ ```typescript
127
+ // Imperative
128
+ const results = [];
129
+ for (const user of users) {
130
+ if (user.isActive) {
131
+ results.push(user.email);
132
+ }
133
+ }
134
+
135
+ // Declarative
136
+ const activeEmails = users
137
+ .filter(user => user.isActive)
138
+ .map(user => user.email);
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Side Effects at the Edges
144
+
145
+ Push side effects to the boundaries:
146
+
147
+ ```
148
+ ┌─────────────────────────────────────────────────────────┐
149
+ │ EDGES (side effects) │
150
+ │ HTTP handlers, database calls, external APIs │
151
+ └───────────────────────────┬─────────────────────────────┘
152
+
153
+
154
+ ┌─────────────────────────────────────────────────────────┐
155
+ │ CORE (pure) │
156
+ │ Business logic, calculations, transformations │
157
+ └─────────────────────────────────────────────────────────┘
158
+ ```
159
+
160
+ ---
161
+
162
+ *Template. Adapt to your needs.*
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: Gitignore Patterns
3
+ description: What to exclude from version control
4
+ triggers: [gitignore, git, secrets]
5
+ type: pattern
6
+ ---
7
+
8
+ # Gitignore Principles
9
+
10
+ Defense-in-depth for preventing secret commits.
11
+
12
+ ---
13
+
14
+ ## Structure
15
+
16
+ Organize by category with clear headers:
17
+
18
+ ```gitignore
19
+ # ============================================================================
20
+ # SECRETS & SENSITIVE FILES (NEVER COMMIT)
21
+ # ============================================================================
22
+
23
+ # Environment files
24
+ .env
25
+ .env.*
26
+ !.env.example
27
+
28
+ # Private keys & certificates
29
+ *.pem
30
+ *.key
31
+ *.p12
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Secrets (Critical)
37
+
38
+ ### Environment Files
39
+
40
+ ```gitignore
41
+ .env
42
+ .env.*
43
+ *.env
44
+ *.env.*
45
+ !.env.example
46
+ !.env.*.example
47
+ .envrc
48
+ .envrc.*
49
+ *.local
50
+ ```
51
+
52
+ ### Private Keys
53
+
54
+ ```gitignore
55
+ *.pem
56
+ *.key
57
+ *.p12
58
+ *.pfx
59
+ *.jks
60
+ *.crt
61
+ id_rsa*
62
+ id_ed25519*
63
+ *.gpg
64
+ *.asc
65
+ ```
66
+
67
+ ### Credentials
68
+
69
+ ```gitignore
70
+ credentials.json
71
+ secrets.json
72
+ service-account*.json
73
+ *-keyfile.json
74
+ *.secret
75
+ *.credentials
76
+ application_default_credentials.json
77
+ ```
78
+
79
+ ### Cloud Configs
80
+
81
+ ```gitignore
82
+ .aws/
83
+ .gcloud/
84
+ .azure/
85
+ *.tfstate
86
+ *.tfvars
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Paranoid Mode
92
+
93
+ Catch-all patterns for defense-in-depth:
94
+
95
+ ```gitignore
96
+ # Anything with "secret" in the name
97
+ *secret*
98
+ *SECRET*
99
+ !hooks/*-secrets.sh # Allow hook scripts
100
+
101
+ # Anything with "password" in the name
102
+ *password*
103
+ *PASSWORD*
104
+
105
+ # Anything with "credential" in the name
106
+ *credential*
107
+ *CREDENTIAL*
108
+
109
+ # Anything with "private" in the name
110
+ *_private.*
111
+ *.private.*
112
+ ```
113
+
114
+ ---
115
+
116
+ ## OS & Editor
117
+
118
+ ```gitignore
119
+ # macOS
120
+ .DS_Store
121
+ ._*
122
+
123
+ # Windows
124
+ Thumbs.db
125
+ Desktop.ini
126
+
127
+ # IDEs (allow shared settings)
128
+ .vscode/
129
+ !.vscode/settings.json
130
+ !.vscode/extensions.json
131
+ .idea/
132
+
133
+ # Vim
134
+ *.swp
135
+ *.swo
136
+ ```
137
+
138
+ ---
139
+
140
+ ## Dependencies by Language
141
+
142
+ ```gitignore
143
+ # Node
144
+ node_modules/
145
+ .pnpm-store/
146
+
147
+ # Python
148
+ __pycache__/
149
+ *.py[cod]
150
+ .venv/
151
+ *.egg-info/
152
+ .pytest_cache/
153
+ .mypy_cache/
154
+ .ruff_cache/
155
+
156
+ # Go
157
+ vendor/
158
+
159
+ # Rust
160
+ target/
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Build & Test Output
166
+
167
+ ```gitignore
168
+ dist/
169
+ build/
170
+ out/
171
+ coverage/
172
+ htmlcov/
173
+ .coverage
174
+ *.log
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Tool-Specific
180
+
181
+ ```gitignore
182
+ # Terraform (SECRETS!)
183
+ .terraform/
184
+ *.tfstate*
185
+ *.tfvars
186
+
187
+ # Docker
188
+ docker-compose.override.yml
189
+
190
+ # Kubernetes
191
+ *.kubeconfig
192
+ *-secret.yaml
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Anti-patterns
198
+
199
+ ```gitignore
200
+ # Bad: too broad
201
+ *
202
+
203
+ # Bad: no exceptions for examples
204
+ .env*
205
+
206
+ # Bad: missing paranoid patterns
207
+ # (relies only on specific patterns)
208
+
209
+ # Bad: no structure
210
+ .env
211
+ node_modules
212
+ *.log
213
+ .DS_Store
214
+ ```
215
+
216
+ ---
217
+
218
+ *Layer with pre-commit hooks for defense-in-depth.*