@codemieai/code 0.0.33 → 0.0.34
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.
- package/README.md +73 -7
- package/bin/codemie-opencode.js +11 -0
- package/dist/agents/codemie-code/agent.d.ts +17 -1
- package/dist/agents/codemie-code/agent.d.ts.map +1 -1
- package/dist/agents/codemie-code/agent.js +62 -3
- package/dist/agents/codemie-code/agent.js.map +1 -1
- package/dist/agents/codemie-code/index.d.ts +1 -0
- package/dist/agents/codemie-code/index.d.ts.map +1 -1
- package/dist/agents/codemie-code/index.js +28 -2
- package/dist/agents/codemie-code/index.js.map +1 -1
- package/dist/agents/codemie-code/prompts.d.ts +12 -3
- package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
- package/dist/agents/codemie-code/prompts.js +25 -5
- package/dist/agents/codemie-code/prompts.js.map +1 -1
- package/dist/agents/codemie-code/types.d.ts +3 -0
- package/dist/agents/codemie-code/types.d.ts.map +1 -1
- package/dist/agents/codemie-code/types.js.map +1 -1
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +3 -1
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +33 -0
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/session/BaseSessionAdapter.d.ts +25 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
- package/dist/agents/core/session/discovery-types.d.ts +53 -0
- package/dist/agents/core/session/discovery-types.d.ts.map +1 -0
- package/dist/agents/core/session/discovery-types.js +8 -0
- package/dist/agents/core/session/discovery-types.js.map +1 -0
- package/dist/agents/core/types.d.ts +45 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +44 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +214 -0
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/README.md +40 -2
- package/dist/agents/plugins/claude/plugin/claude-templates/README.md +5 -5
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/CLAUDE.md.template +177 -436
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/code-review-agent-template.md.template +49 -82
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/refactor-cleaner-agent.md.template +337 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/solution-architect-agent.md.template +129 -419
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/unit-tester-agent.md.template +146 -693
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/api/api-patterns.md.template +110 -138
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/architecture.md.template +197 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/data/database-patterns.md.template +171 -91
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/development/development-practices.md.template +219 -131
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/security/security-practices.md.template +223 -98
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/standards/code-quality.md.template +131 -95
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/testing/testing-patterns.md.template +247 -75
- package/dist/agents/plugins/claude/plugin/commands/README.md +133 -0
- package/dist/agents/plugins/claude/plugin/commands/codemie-init.md +336 -544
- package/dist/agents/plugins/claude/plugin/commands/codemie-subagents.md +232 -503
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +311 -30
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +218 -39
- package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/gemini/gemini.plugin.js +0 -3
- package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
- package/dist/agents/plugins/opencode/index.d.ts +8 -0
- package/dist/agents/plugins/opencode/index.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/index.js +12 -0
- package/dist/agents/plugins/opencode/index.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode-message-types.d.ts +207 -0
- package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode-message-types.js +59 -0
- package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +65 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.js +184 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.paths.d.ts +62 -0
- package/dist/agents/plugins/opencode/opencode.paths.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.paths.js +148 -0
- package/dist/agents/plugins/opencode/opencode.paths.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.plugin.d.ts +35 -0
- package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.plugin.js +338 -0
- package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.session.d.ts +77 -0
- package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.session.js +424 -0
- package/dist/agents/plugins/opencode/opencode.session.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts +25 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.js +96 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.js.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts +30 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js +116 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +102 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +584 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -0
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +2 -0
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +5 -0
- package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/AgentsCheck.js +29 -0
- package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +86 -7
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/opencode-metrics.d.ts +13 -0
- package/dist/cli/commands/opencode-metrics.d.ts.map +1 -0
- package/dist/cli/commands/opencode-metrics.js +200 -0
- package/dist/cli/commands/opencode-metrics.js.map +1 -0
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +113 -0
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/skill.d.ts +6 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +196 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +34 -6
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/migrations/003-remove-hooks-node.migration.d.ts +22 -0
- package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -0
- package/dist/migrations/003-remove-hooks-node.migration.js +103 -0
- package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -0
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +1 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/providers/plugins/sso/sso.http-client.js +2 -2
- package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js +14 -10
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
- package/dist/skills/core/SkillDiscovery.d.ts +83 -0
- package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
- package/dist/skills/core/SkillDiscovery.js +237 -0
- package/dist/skills/core/SkillDiscovery.js.map +1 -0
- package/dist/skills/core/SkillManager.d.ts +86 -0
- package/dist/skills/core/SkillManager.d.ts.map +1 -0
- package/dist/skills/core/SkillManager.js +155 -0
- package/dist/skills/core/SkillManager.js.map +1 -0
- package/dist/skills/core/types.d.ts +120 -0
- package/dist/skills/core/types.d.ts.map +1 -0
- package/dist/skills/core/types.js +20 -0
- package/dist/skills/core/types.js.map +1 -0
- package/dist/skills/index.d.ts +12 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +12 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/utils/content-loader.d.ts +25 -0
- package/dist/skills/utils/content-loader.d.ts.map +1 -0
- package/dist/skills/utils/content-loader.js +161 -0
- package/dist/skills/utils/content-loader.js.map +1 -0
- package/dist/skills/utils/frontmatter.d.ts +60 -0
- package/dist/skills/utils/frontmatter.d.ts.map +1 -0
- package/dist/skills/utils/frontmatter.js +114 -0
- package/dist/skills/utils/frontmatter.js.map +1 -0
- package/dist/skills/utils/pattern-matcher.d.ts +60 -0
- package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
- package/dist/skills/utils/pattern-matcher.js +97 -0
- package/dist/skills/utils/pattern-matcher.js.map +1 -0
- package/dist/utils/installation-detector.d.ts +22 -0
- package/dist/utils/installation-detector.d.ts.map +1 -0
- package/dist/utils/installation-detector.js +49 -0
- package/dist/utils/installation-detector.js.map +1 -0
- package/dist/utils/native-installer.d.ts +49 -0
- package/dist/utils/native-installer.d.ts.map +1 -0
- package/dist/utils/native-installer.js +194 -0
- package/dist/utils/native-installer.js.map +1 -0
- package/dist/utils/version-utils.d.ts +50 -0
- package/dist/utils/version-utils.d.ts.map +1 -0
- package/dist/utils/version-utils.js +92 -0
- package/dist/utils/version-utils.js.map +1 -0
- package/package.json +5 -2
- package/scripts/copy-mr-skill-to-global.ts +252 -0
- package/scripts/demo-hooks.sh +125 -0
- package/scripts/test-hooks.sh +196 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/INDEX.md +0 -205
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/TEMPLATE_SIZES.md +0 -74
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/layered-architecture.md.template +0 -143
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/project-structure.md.template +0 -127
|
@@ -1,168 +1,248 @@
|
|
|
1
|
+
---
|
|
1
2
|
# Database Patterns
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<!--
|
|
5
|
+
GENERATION INSTRUCTIONS:
|
|
6
|
+
1. Detect ORM/query builder/raw SQL approach
|
|
7
|
+
2. Scan models/entities for relationships
|
|
8
|
+
3. Extract actual query patterns from repositories/services
|
|
9
|
+
4. Find transaction usage examples
|
|
10
|
+
5. Locate migration files and commands
|
|
11
|
+
6. Output: 150-300 lines max
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
**Project**: [Extract from config]
|
|
15
|
+
**Database**: [Detect: PostgreSQL | MySQL | MongoDB | SQLite | etc.]
|
|
16
|
+
**Data Access**: [Detect: ORM (name) | Query Builder | Raw SQL | Mixed]
|
|
17
|
+
**Models Location**: `[Detect path]`
|
|
18
|
+
|
|
19
|
+
---
|
|
4
20
|
|
|
5
|
-
|
|
21
|
+
## Connection Setup
|
|
6
22
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
23
|
+
<!-- Extract actual connection configuration -->
|
|
24
|
+
|
|
25
|
+
```[lang]
|
|
26
|
+
// Source: [file:lines]
|
|
27
|
+
[Extract connection/pool configuration]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Environment Variables**:
|
|
31
|
+
| Variable | Purpose |
|
|
32
|
+
|----------|---------|
|
|
33
|
+
| `[DB_HOST/DATABASE_URL]` | [Connection string or host] |
|
|
34
|
+
| `[DB_NAME]` | [Database name] |
|
|
35
|
+
| `[DB_POOL_SIZE]` | [Pool size if configured] |
|
|
10
36
|
|
|
11
37
|
---
|
|
12
38
|
|
|
13
|
-
##
|
|
39
|
+
## Data Access Pattern
|
|
40
|
+
|
|
41
|
+
<!-- Identify how this codebase accesses data -->
|
|
14
42
|
|
|
15
|
-
**
|
|
43
|
+
**Pattern**: [Detect: Repository | Active Record | DAO | Direct ORM | Service Layer]
|
|
16
44
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- ✅ Use tables for multiple patterns
|
|
22
|
-
- ❌ NO multiple examples for same pattern
|
|
23
|
-
- ❌ NO verbose explanations
|
|
24
|
-
- ❌ NO copying entire functions
|
|
45
|
+
```[lang]
|
|
46
|
+
// Source: [file:lines]
|
|
47
|
+
[Extract canonical data access example - the PRIMARY pattern used]
|
|
48
|
+
```
|
|
25
49
|
|
|
26
|
-
**
|
|
27
|
-
|
|
50
|
+
**To add new data access:**
|
|
51
|
+
1. Create in `[detected path]`
|
|
52
|
+
2. Follow pattern: `[detected naming convention]`
|
|
53
|
+
3. Inject/import via `[detected DI or import pattern]`
|
|
28
54
|
|
|
29
55
|
---
|
|
30
56
|
|
|
31
|
-
##
|
|
57
|
+
## Entity/Model Definition
|
|
58
|
+
|
|
59
|
+
<!-- Extract representative model showing conventions -->
|
|
32
60
|
|
|
33
|
-
```[
|
|
34
|
-
|
|
35
|
-
[
|
|
61
|
+
```[lang]
|
|
62
|
+
// Source: [file:lines]
|
|
63
|
+
[Extract one model with relationships, validations, typical fields]
|
|
36
64
|
```
|
|
37
65
|
|
|
38
|
-
**
|
|
66
|
+
**Conventions:**
|
|
67
|
+
| Aspect | Convention |
|
|
68
|
+
|--------|------------|
|
|
69
|
+
| Table naming | `[singular/plural, snake_case/PascalCase]` |
|
|
70
|
+
| Primary key | `[id/uuid/_id pattern]` |
|
|
71
|
+
| Timestamps | `[created_at/createdAt, updated_at/updatedAt]` |
|
|
72
|
+
| Soft delete | `[deleted_at field or N/A]` |
|
|
39
73
|
|
|
40
74
|
---
|
|
41
75
|
|
|
42
|
-
##
|
|
76
|
+
## Relationships
|
|
43
77
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
78
|
+
<!-- Scan models and document relationship patterns -->
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
[EntityA] ──1:N──► [EntityB] ──N:M──► [EntityC]
|
|
82
|
+
│
|
|
83
|
+
1:1─┴─► [EntityD]
|
|
47
84
|
```
|
|
48
85
|
|
|
49
|
-
|
|
86
|
+
| Relationship | Implementation | Source |
|
|
87
|
+
|--------------|----------------|--------|
|
|
88
|
+
| One-to-Many | `[syntax used]` | `[file:line]` |
|
|
89
|
+
| Many-to-Many | `[syntax used]` | `[file:line]` |
|
|
90
|
+
| One-to-One | `[syntax used]` | `[file:line]` |
|
|
50
91
|
|
|
51
92
|
---
|
|
52
93
|
|
|
53
|
-
##
|
|
94
|
+
## Query Patterns
|
|
54
95
|
|
|
55
|
-
|
|
96
|
+
<!-- Extract actual query patterns used in codebase -->
|
|
56
97
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
98
|
+
### Basic Operations
|
|
99
|
+
|
|
100
|
+
| Operation | Pattern | Source |
|
|
101
|
+
|-----------|---------|--------|
|
|
102
|
+
| Find by ID | `[extract syntax]` | `[file:line]` |
|
|
103
|
+
| Find many | `[extract syntax]` | `[file:line]` |
|
|
104
|
+
| Create | `[extract syntax]` | `[file:line]` |
|
|
105
|
+
| Update | `[extract syntax]` | `[file:line]` |
|
|
106
|
+
| Delete | `[extract syntax]` | `[file:line]` |
|
|
61
107
|
|
|
62
|
-
###
|
|
108
|
+
### Filtering & Search
|
|
63
109
|
|
|
64
|
-
```[
|
|
65
|
-
|
|
66
|
-
[
|
|
110
|
+
```[lang]
|
|
111
|
+
// Source: [file:lines]
|
|
112
|
+
[Extract example with WHERE conditions, filtering]
|
|
67
113
|
```
|
|
68
114
|
|
|
69
|
-
###
|
|
115
|
+
### Pagination
|
|
70
116
|
|
|
71
|
-
```[
|
|
72
|
-
|
|
73
|
-
[
|
|
117
|
+
```[lang]
|
|
118
|
+
// Source: [file:lines]
|
|
119
|
+
[Extract pagination implementation]
|
|
74
120
|
```
|
|
75
121
|
|
|
76
|
-
|
|
122
|
+
**Type**: [Offset-based | Cursor-based | Keyset]
|
|
123
|
+
**Params**: `[page/limit or cursor/take]`
|
|
77
124
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
[
|
|
125
|
+
### Complex Query Example
|
|
126
|
+
|
|
127
|
+
```[lang]
|
|
128
|
+
// Source: [file:lines]
|
|
129
|
+
[Extract query with joins, aggregations, or subqueries if exists]
|
|
81
130
|
```
|
|
82
131
|
|
|
83
132
|
---
|
|
84
133
|
|
|
85
134
|
## Transactions
|
|
86
135
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
[
|
|
136
|
+
<!-- Find transaction usage in codebase -->
|
|
137
|
+
|
|
138
|
+
```[lang]
|
|
139
|
+
// Source: [file:lines]
|
|
140
|
+
[Extract transaction pattern]
|
|
90
141
|
```
|
|
91
142
|
|
|
92
|
-
**
|
|
93
|
-
- Multiple related writes
|
|
94
|
-
- Data consistency requirements
|
|
143
|
+
**Transaction boundaries managed at**: `[Service layer | Repository | Controller]`
|
|
95
144
|
|
|
96
|
-
**Rules
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
- Handle rollback
|
|
145
|
+
**Rules in this codebase:**
|
|
146
|
+
- [Extract or infer transaction conventions]
|
|
147
|
+
- [When transactions are used]
|
|
100
148
|
|
|
101
149
|
---
|
|
102
150
|
|
|
103
|
-
##
|
|
151
|
+
## Eager Loading / N+1 Prevention
|
|
104
152
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
[
|
|
153
|
+
<!-- Find include/join/populate patterns -->
|
|
154
|
+
|
|
155
|
+
```[lang]
|
|
156
|
+
// Source: [file:lines]
|
|
157
|
+
[Extract eager loading example]
|
|
108
158
|
```
|
|
109
159
|
|
|
110
|
-
**
|
|
160
|
+
**Syntax**: `[include/populate/joinedLoad/with - whatever ORM uses]`
|
|
111
161
|
|
|
112
162
|
---
|
|
113
163
|
|
|
114
|
-
##
|
|
164
|
+
## Migrations
|
|
115
165
|
|
|
116
|
-
|
|
117
|
-
# Problem: N+1
|
|
118
|
-
[n_plus_1_problem]
|
|
166
|
+
<!-- Extract exact commands from package.json, Makefile, or docs -->
|
|
119
167
|
|
|
120
|
-
|
|
121
|
-
|
|
168
|
+
| Action | Command |
|
|
169
|
+
|--------|---------|
|
|
170
|
+
| Create migration | `[exact command]` |
|
|
171
|
+
| Run pending | `[exact command]` |
|
|
172
|
+
| Rollback last | `[exact command]` |
|
|
173
|
+
| Check status | `[exact command]` |
|
|
174
|
+
|
|
175
|
+
**Migrations location**: `[path]`
|
|
176
|
+
|
|
177
|
+
**Naming convention**: `[timestamp_description | sequential | etc.]`
|
|
178
|
+
|
|
179
|
+
```[lang]
|
|
180
|
+
// Source: [file:lines]
|
|
181
|
+
[Extract example migration structure]
|
|
122
182
|
```
|
|
123
183
|
|
|
124
184
|
---
|
|
125
185
|
|
|
126
|
-
##
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
# Create migration
|
|
130
|
-
[create_migration]
|
|
186
|
+
## Seeding / Fixtures
|
|
131
187
|
|
|
132
|
-
|
|
133
|
-
[run_migrations]
|
|
188
|
+
<!-- Find seed data patterns if they exist -->
|
|
134
189
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
190
|
+
| Action | Command |
|
|
191
|
+
|--------|---------|
|
|
192
|
+
| Run seeds | `[command or N/A]` |
|
|
193
|
+
| Reset + seed | `[command or N/A]` |
|
|
138
194
|
|
|
139
|
-
**
|
|
140
|
-
- Always include rollback
|
|
141
|
-
- Test on copy of prod data
|
|
142
|
-
- Never modify existing migrations
|
|
195
|
+
**Seeds location**: `[path or N/A]`
|
|
143
196
|
|
|
144
197
|
---
|
|
145
198
|
|
|
146
199
|
## Raw Queries
|
|
147
200
|
|
|
148
|
-
|
|
149
|
-
# ALWAYS parameterized - Source: [file:lines]
|
|
150
|
-
[parameterized_query]
|
|
201
|
+
<!-- Find if/how raw SQL is used -->
|
|
151
202
|
|
|
152
|
-
|
|
153
|
-
|
|
203
|
+
**Used for**: [Complex reports | Bulk operations | Not used | etc.]
|
|
204
|
+
|
|
205
|
+
```[lang]
|
|
206
|
+
// Source: [file:lines] - ALWAYS parameterized
|
|
207
|
+
[Extract parameterized raw query example]
|
|
154
208
|
```
|
|
155
209
|
|
|
210
|
+
⚠️ **Never**: String interpolation → SQL injection risk
|
|
211
|
+
|
|
156
212
|
---
|
|
157
213
|
|
|
158
|
-
##
|
|
214
|
+
## Error Handling
|
|
215
|
+
|
|
216
|
+
<!-- Find database error handling patterns -->
|
|
217
|
+
|
|
218
|
+
| Error Type | Handling | Source |
|
|
219
|
+
|------------|----------|--------|
|
|
220
|
+
| Not found | `[throw/return pattern]` | `[file:line]` |
|
|
221
|
+
| Duplicate key | `[catch/handle pattern]` | `[file:line]` |
|
|
222
|
+
| Connection error | `[retry/fail pattern]` | `[file:line]` |
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Conventions Summary
|
|
159
227
|
|
|
160
228
|
| ✅ DO | ❌ DON'T |
|
|
161
229
|
|-------|----------|
|
|
162
|
-
| Use
|
|
163
|
-
|
|
|
164
|
-
|
|
|
165
|
-
|
|
|
166
|
-
|
|
|
230
|
+
| Use `[detected data access pattern]` | Direct DB calls in `[wrong layer]` |
|
|
231
|
+
| `[eager load syntax]` for relations | Lazy load in loops (N+1) |
|
|
232
|
+
| Parameterized queries | String interpolation |
|
|
233
|
+
| Transactions for multi-writes | Individual saves for related data |
|
|
234
|
+
| `[soft delete if used]` | Hard delete `[if soft delete is convention]` |
|
|
167
235
|
|
|
168
236
|
---
|
|
237
|
+
|
|
238
|
+
## Quick Reference
|
|
239
|
+
|
|
240
|
+
| Need | Location | Pattern |
|
|
241
|
+
|------|----------|---------|
|
|
242
|
+
| Models/Entities | `[path]` | `[naming]` |
|
|
243
|
+
| Repositories/DAOs | `[path]` | `[naming]` |
|
|
244
|
+
| Migrations | `[path]` | `[naming]` |
|
|
245
|
+
| Seeds | `[path]` | `[naming]` |
|
|
246
|
+
| DB Config | `[path]` | - |
|
|
247
|
+
|
|
248
|
+
---
|