proagents 1.6.20 → 1.6.22
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/.claude/settings.local.json +3 -1
- package/.proagents/.cursorrules +1 -1
- package/.proagents/.windsurfrules +1 -1
- package/.proagents/AGENTS.md +1 -1
- package/.proagents/AI_INSTRUCTIONS.md +29 -1
- package/.proagents/BOLT.md +1 -1
- package/.proagents/CLAUDE.md +1 -1
- package/.proagents/GEMINI.md +1 -1
- package/.proagents/KIRO.md +1 -1
- package/.proagents/LOVABLE.md +1 -1
- package/.proagents/REPLIT.md +1 -1
- package/.proagents/custom-commands.yaml +1 -2
- package/.proagents/docs/command-details.md +1 -2
- package/.proagents/getting-started/ai-training-setup.md +0 -1
- package/.proagents/performance/README.md +59 -0
- package/.proagents/performance/bundle-analysis.md +375 -0
- package/.proagents/performance/load-testing.md +563 -0
- package/.proagents/performance/runtime-metrics.md +489 -0
- package/.proagents/performance/web-vitals.md +425 -0
- package/.proagents/proagents.config.yaml +55 -1
- package/.proagents/prompts/11-session-tracking.md +100 -0
- package/.proagents/prompts/13-commit.md +426 -0
- package/.proagents/workflow-modes/entry-modes.md +1 -6
- package/COMMANDS.md +19 -0
- package/lib/commands/init.js +62 -11
- package/package.json +1 -1
- package/.proagents/api-versioning/README.md +0 -257
- package/.proagents/api-versioning/changelog-template.md +0 -225
- package/.proagents/api-versioning/deprecation-workflow.md +0 -470
- package/.proagents/api-versioning/versioning-strategy.md +0 -291
- package/.proagents/automation/README.md +0 -38
- package/.proagents/automation/ai-behavior-rules.md +0 -339
- package/.proagents/automation/ai-prompt-injection.md +0 -331
- package/.proagents/automation/auto-decisions.md +0 -535
- package/.proagents/automation/decision-defaults.yaml +0 -317
- package/.proagents/cache/README.md +0 -110
- package/.proagents/cache/analysis-metadata.json +0 -76
- package/.proagents/cache/conventions.json +0 -125
- package/.proagents/cache/dependencies.json +0 -85
- package/.proagents/cache/features.json +0 -115
- package/.proagents/cache/patterns.json +0 -105
- package/.proagents/cache/schemas/conventions-schema.json +0 -138
- package/.proagents/cache/schemas/dependencies-schema.json +0 -95
- package/.proagents/cache/schemas/features-schema.json +0 -104
- package/.proagents/cache/schemas/metadata-schema.json +0 -83
- package/.proagents/cache/schemas/patterns-schema.json +0 -136
- package/.proagents/cache/schemas/structure-schema.json +0 -72
- package/.proagents/cache/structure.json +0 -109
- package/.proagents/checklists/README.md +0 -261
- package/.proagents/checklists/code-quality.md +0 -137
- package/.proagents/checklists/code-review.md +0 -148
- package/.proagents/checklists/pr-checklist.md +0 -78
- package/.proagents/checklists/pre-deployment.md +0 -132
- package/.proagents/checklists/pre-implementation.md +0 -80
- package/.proagents/checklists/testing.md +0 -120
- package/.proagents/checkpoints.json +0 -13
- package/.proagents/cicd/README.md +0 -338
- package/.proagents/cicd/azure-devops.md +0 -267
- package/.proagents/cicd/github-actions.md +0 -375
- package/.proagents/cicd/gitlab-ci.md +0 -278
- package/.proagents/cicd/jenkins.md +0 -317
- package/.proagents/collaboration/README.md +0 -143
- package/.proagents/collaboration/roles.md +0 -248
- package/.proagents/collaboration/sessions.md +0 -390
- package/.proagents/collaboration/sync.md +0 -358
- package/.proagents/cost/README.md +0 -48
- package/.proagents/cost/cost-template.md +0 -283
- package/.proagents/cost/estimation-framework.md +0 -287
- package/.proagents/database/README.md +0 -72
- package/.proagents/database/examples/001-create-users.sql +0 -129
- package/.proagents/database/examples/002-add-preferences.sql +0 -94
- package/.proagents/database/examples/003-add-index.sql +0 -105
- package/.proagents/database/examples/004-rename-column.sql +0 -122
- package/.proagents/database/examples/005-add-foreign-key.sql +0 -142
- package/.proagents/database/examples/006-data-migration.sql +0 -196
- package/.proagents/database/examples/007-drop-column.sql +0 -163
- package/.proagents/database/examples/README.md +0 -89
- package/.proagents/database/migration-workflow.md +0 -478
- package/.proagents/database/rollback-scripts.md +0 -487
- package/.proagents/database/safety-checks.md +0 -447
- package/.proagents/git/README.md +0 -68
- package/.proagents/git/branch-strategy.md +0 -164
- package/.proagents/git/commit-conventions.md +0 -241
- package/.proagents/git/pr-workflow.md +0 -286
- package/.proagents/git/rollback-procedures.md +0 -416
- package/.proagents/ide-integration/README.md +0 -124
- package/.proagents/ide-integration/cline-config.md +0 -429
- package/.proagents/ide-integration/continue-config.md +0 -380
- package/.proagents/ide-integration/cursor-rules.md +0 -280
- package/.proagents/ide-integration/github-copilot.md +0 -384
- package/.proagents/ide-integration/windsurf-rules.md +0 -314
- package/.proagents/integrations/README.md +0 -97
- package/.proagents/integrations/pm/README.md +0 -344
- package/.proagents/learning/README.md +0 -136
- package/.proagents/learning/adaptation.md +0 -305
- package/.proagents/learning/data-collection.md +0 -283
- package/.proagents/learning/implementation-guide.md +0 -865
- package/.proagents/learning/reports.md +0 -306
- package/.proagents/mcp/README.md +0 -133
- package/.proagents/mcp/context-providers.md +0 -442
- package/.proagents/mcp/server-config.md +0 -306
- package/.proagents/mcp/tools-definition.md +0 -513
- package/.proagents/pm-integration/README.md +0 -151
- package/.proagents/pm-integration/asana.md +0 -346
- package/.proagents/pm-integration/github-issues.md +0 -308
- package/.proagents/pm-integration/gitlab-issues.md +0 -482
- package/.proagents/pm-integration/jira.md +0 -364
- package/.proagents/pm-integration/linear.md +0 -409
- package/.proagents/pm-integration/notion.md +0 -275
- package/.proagents/pm-integration/sync-config.md +0 -533
- package/.proagents/pm-integration/trello.md +0 -159
- package/.proagents/rules/README.md +0 -179
- package/.proagents/rules/custom-rules-template.yaml +0 -286
- package/.proagents/rules/custom-rules.md +0 -754
- package/.proagents/rules/validation-rules-template.yaml +0 -517
- package/.proagents/runbooks/README.md +0 -219
- package/.proagents/runbooks/dependency-vulnerability.md +0 -505
- package/.proagents/runbooks/incident-response.md +0 -451
- package/.proagents/runbooks/performance-degradation.md +0 -584
- package/.proagents/runbooks/production-debugging.md +0 -489
- package/.proagents/sessions/README.md +0 -5
- package/.proagents/sprints/README.md +0 -58
- package/.proagents/team/README.md +0 -256
- package/.proagents/team/code-ownership.md +0 -306
- package/.proagents/team/communication-templates.md +0 -441
- package/.proagents/team/handoff-protocol.md +0 -380
- package/.proagents/team/ide-setup/README.md +0 -103
- package/.proagents/team/ide-setup/cursor.md +0 -276
- package/.proagents/team/ide-setup/jetbrains.md +0 -330
- package/.proagents/team/ide-setup/neovim.md +0 -640
- package/.proagents/team/ide-setup/vscode.md +0 -348
- package/.proagents/team/onboarding.md +0 -278
- package/.proagents/time-tracking.json +0 -19
- package/.proagents/troubleshooting/README.md +0 -730
- package/.proagents/troubleshooting/ai-issues.md +0 -601
- package/.proagents/troubleshooting/workflow-issues.md +0 -571
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
# Database Migration Safety Checks
|
|
2
|
-
|
|
3
|
-
Ensure database migrations are safe before execution.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Database migrations are high-risk operations. This guide provides:
|
|
10
|
-
- Pre-migration safety checks
|
|
11
|
-
- Risk assessment criteria
|
|
12
|
-
- Safe migration patterns
|
|
13
|
-
- Rollback verification
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Risk Assessment Matrix
|
|
18
|
-
|
|
19
|
-
| Operation | Risk Level | Requirements |
|
|
20
|
-
|-----------|------------|--------------|
|
|
21
|
-
| Add column (nullable) | Low | Auto-approve |
|
|
22
|
-
| Add column (NOT NULL with default) | Low | Auto-approve |
|
|
23
|
-
| Add column (NOT NULL, no default) | High | Backfill plan required |
|
|
24
|
-
| Add index | Medium | Performance review |
|
|
25
|
-
| Add unique constraint | High | Data validation first |
|
|
26
|
-
| Add foreign key | Medium | Data integrity check |
|
|
27
|
-
| Alter column type | High | Data compatibility check |
|
|
28
|
-
| Rename column | Medium | Application update required |
|
|
29
|
-
| Drop column | High | Deprecation period |
|
|
30
|
-
| Drop table | Critical | Multiple approvals |
|
|
31
|
-
| Drop index | Low | Performance impact review |
|
|
32
|
-
| Truncate table | Critical | Backup required |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Pre-Migration Checklist
|
|
37
|
-
|
|
38
|
-
### Automated Checks
|
|
39
|
-
|
|
40
|
-
```yaml
|
|
41
|
-
safety_checks:
|
|
42
|
-
pre_migration:
|
|
43
|
-
- name: "Backup Exists"
|
|
44
|
-
check: "Recent backup within 24 hours"
|
|
45
|
-
required: true
|
|
46
|
-
action: "Block if no backup"
|
|
47
|
-
|
|
48
|
-
- name: "Schema Diff Analysis"
|
|
49
|
-
check: "Generate and review schema diff"
|
|
50
|
-
required: true
|
|
51
|
-
action: "Show diff for review"
|
|
52
|
-
|
|
53
|
-
- name: "Data Impact Assessment"
|
|
54
|
-
check: "Estimate rows affected"
|
|
55
|
-
required: true
|
|
56
|
-
thresholds:
|
|
57
|
-
low: "<1000 rows"
|
|
58
|
-
medium: "1000-100000 rows"
|
|
59
|
-
high: ">100000 rows"
|
|
60
|
-
|
|
61
|
-
- name: "Lock Duration Estimate"
|
|
62
|
-
check: "Estimate table lock time"
|
|
63
|
-
required: true
|
|
64
|
-
thresholds:
|
|
65
|
-
safe: "<1 second"
|
|
66
|
-
warning: "1-30 seconds"
|
|
67
|
-
critical: ">30 seconds"
|
|
68
|
-
|
|
69
|
-
- name: "Rollback Script Exists"
|
|
70
|
-
check: "Down migration defined"
|
|
71
|
-
required: true
|
|
72
|
-
action: "Block if missing"
|
|
73
|
-
|
|
74
|
-
- name: "Test Environment Validated"
|
|
75
|
-
check: "Migration ran on staging"
|
|
76
|
-
required: true
|
|
77
|
-
action: "Block if not tested"
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Manual Review Checklist
|
|
81
|
-
|
|
82
|
-
```markdown
|
|
83
|
-
## Migration Safety Review
|
|
84
|
-
|
|
85
|
-
**Migration:** [Migration Name]
|
|
86
|
-
**Date:** [Date]
|
|
87
|
-
**Reviewer:** [Name]
|
|
88
|
-
|
|
89
|
-
### Pre-checks
|
|
90
|
-
- [ ] Migration tested on staging environment
|
|
91
|
-
- [ ] Data backup verified (< 24 hours old)
|
|
92
|
-
- [ ] Rollback script tested
|
|
93
|
-
- [ ] Application code compatible with both old and new schema
|
|
94
|
-
- [ ] Low traffic window scheduled (if required)
|
|
95
|
-
|
|
96
|
-
### Schema Changes Review
|
|
97
|
-
- [ ] All column additions have appropriate defaults
|
|
98
|
-
- [ ] No accidental column drops
|
|
99
|
-
- [ ] Indexes are necessary and optimized
|
|
100
|
-
- [ ] Foreign keys have proper cascading behavior
|
|
101
|
-
|
|
102
|
-
### Data Migration Review
|
|
103
|
-
- [ ] Data transformation logic is correct
|
|
104
|
-
- [ ] No data loss scenarios
|
|
105
|
-
- [ ] Performance tested with production-size data
|
|
106
|
-
- [ ] Timeout and retry handling in place
|
|
107
|
-
|
|
108
|
-
### Deployment Coordination
|
|
109
|
-
- [ ] Team notified of migration
|
|
110
|
-
- [ ] Monitoring dashboards ready
|
|
111
|
-
- [ ] Incident response plan documented
|
|
112
|
-
- [ ] Rollback trigger criteria defined
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Safe Migration Patterns
|
|
118
|
-
|
|
119
|
-
### 1. Adding NOT NULL Column
|
|
120
|
-
|
|
121
|
-
**Unsafe:**
|
|
122
|
-
```sql
|
|
123
|
-
-- ❌ This will fail if table has data
|
|
124
|
-
ALTER TABLE users ADD COLUMN status VARCHAR NOT NULL;
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**Safe Pattern (3-Step):**
|
|
128
|
-
```sql
|
|
129
|
-
-- Step 1: Add nullable column
|
|
130
|
-
ALTER TABLE users ADD COLUMN status VARCHAR;
|
|
131
|
-
|
|
132
|
-
-- Step 2: Backfill data
|
|
133
|
-
UPDATE users SET status = 'active' WHERE status IS NULL;
|
|
134
|
-
|
|
135
|
-
-- Step 3: Add NOT NULL constraint
|
|
136
|
-
ALTER TABLE users ALTER COLUMN status SET NOT NULL;
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
**Prisma Migration:**
|
|
140
|
-
```javascript
|
|
141
|
-
// migration.js
|
|
142
|
-
module.exports = {
|
|
143
|
-
async up(db) {
|
|
144
|
-
// Step 1: Add nullable
|
|
145
|
-
await db.runSql(`
|
|
146
|
-
ALTER TABLE users ADD COLUMN status VARCHAR
|
|
147
|
-
`);
|
|
148
|
-
|
|
149
|
-
// Step 2: Backfill
|
|
150
|
-
await db.runSql(`
|
|
151
|
-
UPDATE users SET status = 'active' WHERE status IS NULL
|
|
152
|
-
`);
|
|
153
|
-
|
|
154
|
-
// Step 3: Add constraint
|
|
155
|
-
await db.runSql(`
|
|
156
|
-
ALTER TABLE users ALTER COLUMN status SET NOT NULL
|
|
157
|
-
`);
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
async down(db) {
|
|
161
|
-
await db.runSql(`ALTER TABLE users DROP COLUMN status`);
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### 2. Renaming Columns
|
|
167
|
-
|
|
168
|
-
**Unsafe:**
|
|
169
|
-
```sql
|
|
170
|
-
-- ❌ Breaks running application
|
|
171
|
-
ALTER TABLE users RENAME COLUMN name TO full_name;
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
**Safe Pattern (Expand-Contract):**
|
|
175
|
-
```sql
|
|
176
|
-
-- Phase 1: Add new column (Deploy)
|
|
177
|
-
ALTER TABLE users ADD COLUMN full_name VARCHAR;
|
|
178
|
-
UPDATE users SET full_name = name;
|
|
179
|
-
|
|
180
|
-
-- Phase 2: Update application to use both columns
|
|
181
|
-
-- Application writes to BOTH name and full_name
|
|
182
|
-
-- Application reads from full_name
|
|
183
|
-
|
|
184
|
-
-- Phase 3: Drop old column (after verification)
|
|
185
|
-
ALTER TABLE users DROP COLUMN name;
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### 3. Adding Unique Constraint
|
|
189
|
-
|
|
190
|
-
**Unsafe:**
|
|
191
|
-
```sql
|
|
192
|
-
-- ❌ Fails if duplicates exist
|
|
193
|
-
ALTER TABLE users ADD CONSTRAINT email_unique UNIQUE (email);
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**Safe Pattern:**
|
|
197
|
-
```sql
|
|
198
|
-
-- Step 1: Check for duplicates
|
|
199
|
-
SELECT email, COUNT(*) as count
|
|
200
|
-
FROM users
|
|
201
|
-
GROUP BY email
|
|
202
|
-
HAVING COUNT(*) > 1;
|
|
203
|
-
|
|
204
|
-
-- Step 2: Resolve duplicates (business logic specific)
|
|
205
|
-
-- ... resolve duplicates ...
|
|
206
|
-
|
|
207
|
-
-- Step 3: Add constraint with validation
|
|
208
|
-
ALTER TABLE users
|
|
209
|
-
ADD CONSTRAINT email_unique UNIQUE (email)
|
|
210
|
-
NOT VALID;
|
|
211
|
-
|
|
212
|
-
-- Step 4: Validate separately (non-blocking)
|
|
213
|
-
ALTER TABLE users
|
|
214
|
-
VALIDATE CONSTRAINT email_unique;
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### 4. Changing Column Type
|
|
218
|
-
|
|
219
|
-
**Unsafe:**
|
|
220
|
-
```sql
|
|
221
|
-
-- ❌ May lose data
|
|
222
|
-
ALTER TABLE orders ALTER COLUMN amount TYPE INTEGER;
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
**Safe Pattern:**
|
|
226
|
-
```sql
|
|
227
|
-
-- Step 1: Add new column
|
|
228
|
-
ALTER TABLE orders ADD COLUMN amount_cents INTEGER;
|
|
229
|
-
|
|
230
|
-
-- Step 2: Migrate data
|
|
231
|
-
UPDATE orders SET amount_cents = CAST(amount * 100 AS INTEGER);
|
|
232
|
-
|
|
233
|
-
-- Step 3: Verify data
|
|
234
|
-
SELECT COUNT(*) FROM orders
|
|
235
|
-
WHERE amount_cents != CAST(amount * 100 AS INTEGER);
|
|
236
|
-
|
|
237
|
-
-- Step 4: Switch application to new column
|
|
238
|
-
-- Step 5: Drop old column (after verification period)
|
|
239
|
-
ALTER TABLE orders DROP COLUMN amount;
|
|
240
|
-
|
|
241
|
-
-- Step 6: Rename (optional)
|
|
242
|
-
ALTER TABLE orders RENAME COLUMN amount_cents TO amount;
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### 5. Adding Index Without Blocking
|
|
246
|
-
|
|
247
|
-
```sql
|
|
248
|
-
-- ❌ Blocks writes
|
|
249
|
-
CREATE INDEX idx_users_email ON users(email);
|
|
250
|
-
|
|
251
|
-
-- ✅ Non-blocking (PostgreSQL)
|
|
252
|
-
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
---
|
|
256
|
-
|
|
257
|
-
## Lock Duration Analysis
|
|
258
|
-
|
|
259
|
-
### Check Current Locks
|
|
260
|
-
|
|
261
|
-
```sql
|
|
262
|
-
-- PostgreSQL: View active locks
|
|
263
|
-
SELECT
|
|
264
|
-
l.relation::regclass AS table,
|
|
265
|
-
l.mode,
|
|
266
|
-
l.granted,
|
|
267
|
-
a.application_name,
|
|
268
|
-
a.query
|
|
269
|
-
FROM pg_locks l
|
|
270
|
-
JOIN pg_stat_activity a ON l.pid = a.pid
|
|
271
|
-
WHERE l.relation IS NOT NULL;
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Estimate Lock Duration
|
|
275
|
-
|
|
276
|
-
```javascript
|
|
277
|
-
// scripts/estimate-lock-duration.js
|
|
278
|
-
|
|
279
|
-
async function estimateLockDuration(migration) {
|
|
280
|
-
const analysis = {
|
|
281
|
-
operations: [],
|
|
282
|
-
estimatedDuration: 0,
|
|
283
|
-
risk: 'low',
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
// Parse migration to identify operations
|
|
287
|
-
if (migration.includes('ALTER TABLE') && migration.includes('ADD COLUMN')) {
|
|
288
|
-
analysis.operations.push({
|
|
289
|
-
type: 'add_column',
|
|
290
|
-
lockType: 'ACCESS EXCLUSIVE',
|
|
291
|
-
estimatedSeconds: 0.1, // Very fast
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (migration.includes('CREATE INDEX') && !migration.includes('CONCURRENTLY')) {
|
|
296
|
-
const rowCount = await getTableRowCount(extractTableName(migration));
|
|
297
|
-
analysis.operations.push({
|
|
298
|
-
type: 'create_index',
|
|
299
|
-
lockType: 'SHARE',
|
|
300
|
-
estimatedSeconds: rowCount / 10000, // Rough estimate
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (migration.includes('DROP COLUMN')) {
|
|
305
|
-
analysis.operations.push({
|
|
306
|
-
type: 'drop_column',
|
|
307
|
-
lockType: 'ACCESS EXCLUSIVE',
|
|
308
|
-
estimatedSeconds: 0.5,
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Calculate total
|
|
313
|
-
analysis.estimatedDuration = analysis.operations.reduce(
|
|
314
|
-
(sum, op) => sum + op.estimatedSeconds, 0
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
// Assess risk
|
|
318
|
-
if (analysis.estimatedDuration > 30) {
|
|
319
|
-
analysis.risk = 'critical';
|
|
320
|
-
} else if (analysis.estimatedDuration > 5) {
|
|
321
|
-
analysis.risk = 'high';
|
|
322
|
-
} else if (analysis.estimatedDuration > 1) {
|
|
323
|
-
analysis.risk = 'medium';
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return analysis;
|
|
327
|
-
}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
|
-
## Automated Safety Script
|
|
333
|
-
|
|
334
|
-
```bash
|
|
335
|
-
#!/bin/bash
|
|
336
|
-
# scripts/migration-safety-check.sh
|
|
337
|
-
|
|
338
|
-
set -e
|
|
339
|
-
|
|
340
|
-
MIGRATION_FILE=$1
|
|
341
|
-
DB_URL=${DATABASE_URL}
|
|
342
|
-
|
|
343
|
-
echo "=== Migration Safety Check ==="
|
|
344
|
-
echo "Migration: $MIGRATION_FILE"
|
|
345
|
-
echo ""
|
|
346
|
-
|
|
347
|
-
# Check 1: Backup exists
|
|
348
|
-
echo "Checking backup..."
|
|
349
|
-
LATEST_BACKUP=$(aws s3 ls s3://backups/db/ --recursive | sort | tail -n 1)
|
|
350
|
-
BACKUP_AGE=$(($(date +%s) - $(date -d "$(echo $LATEST_BACKUP | awk '{print $1" "$2}')" +%s)))
|
|
351
|
-
|
|
352
|
-
if [ $BACKUP_AGE -gt 86400 ]; then
|
|
353
|
-
echo "❌ ERROR: Latest backup is more than 24 hours old"
|
|
354
|
-
exit 1
|
|
355
|
-
fi
|
|
356
|
-
echo "✅ Backup exists (age: ${BACKUP_AGE}s)"
|
|
357
|
-
|
|
358
|
-
# Check 2: Rollback script exists
|
|
359
|
-
DOWN_MIGRATION="${MIGRATION_FILE%.up.sql}.down.sql"
|
|
360
|
-
if [ ! -f "$DOWN_MIGRATION" ]; then
|
|
361
|
-
echo "❌ ERROR: No rollback script found: $DOWN_MIGRATION"
|
|
362
|
-
exit 1
|
|
363
|
-
fi
|
|
364
|
-
echo "✅ Rollback script exists"
|
|
365
|
-
|
|
366
|
-
# Check 3: Schema diff
|
|
367
|
-
echo ""
|
|
368
|
-
echo "Schema Changes:"
|
|
369
|
-
echo "───────────────"
|
|
370
|
-
psql $DB_URL -c "\d" > /tmp/before_schema.txt
|
|
371
|
-
# Show diff preview (dry run)
|
|
372
|
-
|
|
373
|
-
# Check 4: Dangerous operations
|
|
374
|
-
echo ""
|
|
375
|
-
echo "Dangerous Operations Check:"
|
|
376
|
-
if grep -i "DROP TABLE" "$MIGRATION_FILE"; then
|
|
377
|
-
echo "⚠️ WARNING: DROP TABLE detected - requires manual approval"
|
|
378
|
-
fi
|
|
379
|
-
if grep -i "DROP COLUMN" "$MIGRATION_FILE"; then
|
|
380
|
-
echo "⚠️ WARNING: DROP COLUMN detected - requires manual approval"
|
|
381
|
-
fi
|
|
382
|
-
if grep -i "TRUNCATE" "$MIGRATION_FILE"; then
|
|
383
|
-
echo "⚠️ WARNING: TRUNCATE detected - requires manual approval"
|
|
384
|
-
fi
|
|
385
|
-
|
|
386
|
-
# Check 5: Row count for affected tables
|
|
387
|
-
echo ""
|
|
388
|
-
echo "Affected Tables:"
|
|
389
|
-
TABLES=$(grep -oP "(?<=ALTER TABLE |UPDATE |DELETE FROM )[\w_]+" "$MIGRATION_FILE" | sort -u)
|
|
390
|
-
for TABLE in $TABLES; do
|
|
391
|
-
COUNT=$(psql $DB_URL -t -c "SELECT COUNT(*) FROM $TABLE" 2>/dev/null || echo "N/A")
|
|
392
|
-
echo " $TABLE: $COUNT rows"
|
|
393
|
-
done
|
|
394
|
-
|
|
395
|
-
echo ""
|
|
396
|
-
echo "=== Safety Check Complete ==="
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
## Configuration
|
|
402
|
-
|
|
403
|
-
```yaml
|
|
404
|
-
# proagents.config.yaml
|
|
405
|
-
|
|
406
|
-
database:
|
|
407
|
-
safety_checks:
|
|
408
|
-
enabled: true
|
|
409
|
-
|
|
410
|
-
require:
|
|
411
|
-
backup_check: true
|
|
412
|
-
rollback_script: true
|
|
413
|
-
staging_test: true
|
|
414
|
-
schema_diff_review: true
|
|
415
|
-
|
|
416
|
-
thresholds:
|
|
417
|
-
max_lock_duration_seconds: 5
|
|
418
|
-
max_rows_affected: 100000
|
|
419
|
-
max_tables_modified: 3
|
|
420
|
-
|
|
421
|
-
auto_approve:
|
|
422
|
-
- "add_nullable_column"
|
|
423
|
-
- "add_index_concurrent"
|
|
424
|
-
- "drop_index"
|
|
425
|
-
|
|
426
|
-
require_approval:
|
|
427
|
-
- "drop_column"
|
|
428
|
-
- "drop_table"
|
|
429
|
-
- "alter_column_type"
|
|
430
|
-
- "add_not_null"
|
|
431
|
-
|
|
432
|
-
blocked_operations:
|
|
433
|
-
- "truncate_production"
|
|
434
|
-
- "drop_database"
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
---
|
|
438
|
-
|
|
439
|
-
## Commands
|
|
440
|
-
|
|
441
|
-
| Command | Description |
|
|
442
|
-
|---------|-------------|
|
|
443
|
-
| `pa:db-check` | Run safety checks on pending migrations |
|
|
444
|
-
| `pa:db-check --migration [name]` | Check specific migration |
|
|
445
|
-
| `pa:db-check --dry-run` | Preview changes without running |
|
|
446
|
-
| `pa:db-diff` | Show schema diff |
|
|
447
|
-
| `pa:db-locks` | Show active database locks |
|
package/.proagents/git/README.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Git Integration
|
|
2
|
-
|
|
3
|
-
Branch strategy, commit conventions, and PR workflows.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Integrated Git workflows for consistent version control practices.
|
|
10
|
-
|
|
11
|
-
## Documentation
|
|
12
|
-
|
|
13
|
-
| Document | Description |
|
|
14
|
-
|----------|-------------|
|
|
15
|
-
| [Branch Strategy](./branch-strategy.md) | Branch naming and flow |
|
|
16
|
-
| [Commit Conventions](./commit-conventions.md) | Conventional commits, message format |
|
|
17
|
-
| [PR Workflow](./pr-workflow.md) | Pull request process |
|
|
18
|
-
| [Rollback Procedures](./rollback-procedures.md) | Git-based rollback |
|
|
19
|
-
|
|
20
|
-
## Quick Start
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
# Create feature branch
|
|
24
|
-
proagents git branch "user-auth"
|
|
25
|
-
|
|
26
|
-
# Commit with convention
|
|
27
|
-
proagents git commit "feat(auth): add login form"
|
|
28
|
-
|
|
29
|
-
# Create pull request
|
|
30
|
-
proagents git pr create
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Branch Strategy
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
main
|
|
37
|
-
└── develop
|
|
38
|
-
├── feature/user-auth
|
|
39
|
-
├── feature/dashboard
|
|
40
|
-
└── bugfix/login-error
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Configuration
|
|
44
|
-
|
|
45
|
-
```yaml
|
|
46
|
-
# proagents.config.yaml
|
|
47
|
-
git:
|
|
48
|
-
enabled: true
|
|
49
|
-
branch_prefix: "feature/"
|
|
50
|
-
commit_convention: "conventional"
|
|
51
|
-
require_pr: true
|
|
52
|
-
|
|
53
|
-
branch_protection:
|
|
54
|
-
main:
|
|
55
|
-
require_review: true
|
|
56
|
-
require_tests: true
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Commit Types
|
|
60
|
-
|
|
61
|
-
| Type | Description |
|
|
62
|
-
|------|-------------|
|
|
63
|
-
| `feat` | New feature |
|
|
64
|
-
| `fix` | Bug fix |
|
|
65
|
-
| `docs` | Documentation |
|
|
66
|
-
| `refactor` | Code refactoring |
|
|
67
|
-
| `test` | Adding tests |
|
|
68
|
-
| `chore` | Maintenance |
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# Git Branch Strategy
|
|
2
|
-
|
|
3
|
-
ProAgents follows a structured branching strategy for organized development.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Branch Structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
main
|
|
11
|
-
└── develop
|
|
12
|
-
├── feature/user-auth
|
|
13
|
-
├── feature/dashboard
|
|
14
|
-
├── feature/notifications
|
|
15
|
-
├── hotfix/login-fix
|
|
16
|
-
└── release/v1.2.0
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Branch Types
|
|
22
|
-
|
|
23
|
-
### Main Branches
|
|
24
|
-
|
|
25
|
-
| Branch | Purpose |
|
|
26
|
-
|--------|---------|
|
|
27
|
-
| `main` | Production-ready code |
|
|
28
|
-
| `develop` | Integration branch for features |
|
|
29
|
-
|
|
30
|
-
### Supporting Branches
|
|
31
|
-
|
|
32
|
-
| Type | Prefix | Base | Merge To |
|
|
33
|
-
|------|--------|------|----------|
|
|
34
|
-
| Feature | `feature/` | develop | develop |
|
|
35
|
-
| Hotfix | `hotfix/` | main | main + develop |
|
|
36
|
-
| Release | `release/` | develop | main + develop |
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## Branch Naming
|
|
41
|
-
|
|
42
|
-
### Features
|
|
43
|
-
```
|
|
44
|
-
feature/[feature-name]
|
|
45
|
-
feature/add-user-auth
|
|
46
|
-
feature/update-dashboard
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Bug Fixes
|
|
50
|
-
```
|
|
51
|
-
fix/[issue-description]
|
|
52
|
-
fix/login-validation
|
|
53
|
-
fix/api-timeout
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Hotfixes
|
|
57
|
-
```
|
|
58
|
-
hotfix/[critical-issue]
|
|
59
|
-
hotfix/security-patch
|
|
60
|
-
hotfix/payment-bug
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Releases
|
|
64
|
-
```
|
|
65
|
-
release/v[version]
|
|
66
|
-
release/v1.2.0
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Workflow
|
|
72
|
-
|
|
73
|
-
### Starting a Feature
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
# Create feature branch from develop
|
|
77
|
-
git checkout develop
|
|
78
|
-
git pull origin develop
|
|
79
|
-
git checkout -b feature/my-feature
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Or use command:
|
|
83
|
-
```
|
|
84
|
-
pa:branch-feature "my-feature"
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Working on Feature
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Regular commits
|
|
91
|
-
git add .
|
|
92
|
-
git commit -m "feat(scope): description"
|
|
93
|
-
|
|
94
|
-
# Keep branch updated
|
|
95
|
-
git fetch origin
|
|
96
|
-
git rebase origin/develop
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Completing Feature
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
# Push branch
|
|
103
|
-
git push origin feature/my-feature
|
|
104
|
-
|
|
105
|
-
# Create PR to develop
|
|
106
|
-
# (Or use pa:pr-create)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Hotfix
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# Create hotfix from main
|
|
113
|
-
git checkout main
|
|
114
|
-
git pull origin main
|
|
115
|
-
git checkout -b hotfix/critical-fix
|
|
116
|
-
|
|
117
|
-
# Fix the issue
|
|
118
|
-
git commit -m "fix: critical issue"
|
|
119
|
-
|
|
120
|
-
# Merge to main AND develop
|
|
121
|
-
git checkout main
|
|
122
|
-
git merge hotfix/critical-fix
|
|
123
|
-
git checkout develop
|
|
124
|
-
git merge hotfix/critical-fix
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## Commands for Git
|
|
130
|
-
|
|
131
|
-
| Command | Action |
|
|
132
|
-
|---------|--------|
|
|
133
|
-
| `pa:branch-feature "name"` | Create feature branch |
|
|
134
|
-
| `pa:branch-hotfix "name"` | Create hotfix branch |
|
|
135
|
-
| `pa:branch-release "v1.0.0"` | Create release branch |
|
|
136
|
-
| `pa:commit-feat` | Feature commit |
|
|
137
|
-
| `pa:commit-fix` | Fix commit |
|
|
138
|
-
| `pa:pr-create` | Create pull request |
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## Branch Protection Rules
|
|
143
|
-
|
|
144
|
-
### Main Branch
|
|
145
|
-
- Require pull request reviews (1+)
|
|
146
|
-
- Require status checks to pass
|
|
147
|
-
- No direct pushes
|
|
148
|
-
|
|
149
|
-
### Develop Branch
|
|
150
|
-
- Require pull request reviews
|
|
151
|
-
- Require status checks to pass
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Configuration
|
|
156
|
-
|
|
157
|
-
```yaml
|
|
158
|
-
# proagents.config.yaml
|
|
159
|
-
git:
|
|
160
|
-
enabled: true
|
|
161
|
-
branch_prefix: "feature/"
|
|
162
|
-
default_base: "develop"
|
|
163
|
-
require_pr: true
|
|
164
|
-
```
|