migraguard 0.9.2 → 0.10.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.
package/cli-contract.yaml CHANGED
@@ -3,7 +3,7 @@ cliContracts: 0.1.0
3
3
 
4
4
  info:
5
5
  title: migraguard CLI
6
- version: 0.8.4
6
+ version: 0.10.1
7
7
  description: >-
8
8
  PostgreSQL-first schema-aware deployment control — idempotent SQL migrations
9
9
  with CI-enforced integrity checks, expand/contract migration orchestration,
@@ -342,6 +342,15 @@ commandSets:
342
342
  output and saves it to schema.sql.
343
343
  usage:
344
344
  - migraguard dump
345
+ - migraguard dump --dry-run
346
+
347
+ options:
348
+ - name: dry-run
349
+ aliases: [n]
350
+ description: Output normalized schema to stdout without writing schema.sql.
351
+ schema:
352
+ type: boolean
353
+ default: false
345
354
 
346
355
  exits:
347
356
  '0':
@@ -370,6 +379,7 @@ commandSets:
370
379
  sideEffectNote: >-
371
380
  Reads DB schema via pg_dump/mysqldump and writes normalized
372
381
  output to schema.sql.
382
+ safeDryRunOption: dry-run
373
383
  expectedDurationMs: 10000
374
384
  retryableExitCodes: [1]
375
385
 
@@ -1349,225 +1359,92 @@ commandSets:
1349
1359
 
1350
1360
  components:
1351
1361
  schemas:
1352
- # ── AI Agent Interoperability Schemas (SSoT) ─────────
1353
-
1354
- # Conforms to agent-contracts dsl_base/components.yaml#/schemas/agent-evidence.
1355
- # Canonical property names are kind/target/location/excerpt (NOT type/content/source).
1362
+ # ── AI Agent Interoperability Schemas ──────────────────
1363
+ # Canonical definitions copied from agent-contracts dsl_base/components.yaml.
1364
+ # Keep components.yaml in sync when upgrading agent-contracts.
1356
1365
  AgentEvidence:
1357
- type: object
1358
- description: Evidence supporting an agent finding.
1359
- required: [kind]
1360
- properties:
1361
- kind:
1362
- type: string
1363
- enum: [file, command, schema, diff, stdout, stderr, text]
1364
- target:
1365
- type: string
1366
- description: Target identifier (file path, command ID, schema name).
1367
- location:
1368
- type: string
1369
- description: Location within the target (line number, JSON pointer).
1370
- excerpt:
1371
- type: string
1372
- description: Relevant excerpt from the target.
1373
-
1366
+ $ref: 'components.yaml#/schemas/agent-evidence'
1374
1367
  AgentFinding:
1375
- type: object
1376
- description: A single finding from a migration audit.
1377
- required: [severity, category, message]
1378
- properties:
1379
- id:
1380
- type: string
1381
- description: Unique finding identifier.
1382
- severity:
1383
- type: string
1384
- enum: [info, warning, error, critical]
1385
- category:
1386
- type: string
1387
- description: >-
1388
- Finding category. Migration-specific categories:
1389
- lock_risk, idempotency, expand_contract, backfill_safety,
1390
- rollback_risk, deploy_order, allow_directive.
1391
- target:
1392
- type: string
1393
- description: Target of the finding (file path, SQL statement).
1394
- location:
1395
- type: string
1396
- description: Location within the target.
1397
- message:
1398
- type: string
1399
- recommendation:
1400
- type: string
1401
- confidence:
1402
- type: number
1403
- minimum: 0
1404
- maximum: 1
1405
- description: Confidence score (0-1) for LLM-generated findings.
1406
- evidence:
1407
- type: array
1408
- items:
1409
- $ref: '#/components/schemas/AgentEvidence'
1410
- details:
1411
- type: object
1412
- additionalProperties: true
1413
-
1368
+ $ref: 'components.yaml#/schemas/agent-finding'
1414
1369
  AgentRecommendedAction:
1415
- type: object
1416
- description: A recommended action from a migration audit.
1417
- required: [kind, title]
1418
- properties:
1419
- kind:
1420
- type: string
1421
- enum: [run_command, edit_file, review, confirm, block, ignore]
1422
- title:
1423
- type: string
1424
- command:
1425
- type: string
1426
- description: CLI command to run (for run_command kind).
1427
- target:
1428
- type: string
1429
- description: Target file or resource.
1430
- rationale:
1431
- type: string
1432
-
1370
+ $ref: 'components.yaml#/schemas/agent-recommended-action'
1433
1371
  MigrationAuditResult:
1434
- type: object
1435
- description: >-
1436
- Top-level result from a migration safety audit.
1437
- Conforms to cli-contracts AgentAuditResult reference schema.
1438
- required: [summary, riskLevel, findings]
1439
- properties:
1440
- summary:
1441
- type: string
1442
- riskLevel:
1443
- type: string
1444
- enum: [low, medium, high, critical]
1445
- findings:
1446
- type: array
1447
- items:
1448
- $ref: '#/components/schemas/AgentFinding'
1449
- recommendedActions:
1450
- type: array
1451
- items:
1452
- $ref: '#/components/schemas/AgentRecommendedAction'
1453
- metadata:
1454
- type: object
1455
- properties:
1456
- tool:
1457
- type: string
1458
- command:
1459
- type: string
1460
- version:
1461
- type: string
1462
- generatedAt:
1463
- type: string
1464
- adapter:
1465
- type: string
1466
- model:
1467
- type: string
1372
+ $ref: 'components.yaml#/schemas/agent-audit-result'
1468
1373
 
1469
1374
  ExpandContractProposal:
1470
1375
  type: object
1471
1376
  description: >-
1472
1377
  Result from propose-expand-contract command. Contains the proposed
1473
1378
  phased migration group with SQL for each phase.
1474
- required: [summary, riskLevel, findings, phases]
1475
- properties:
1476
- summary:
1477
- type: string
1478
- description: Overview of the proposed decomposition.
1479
- riskLevel:
1480
- type: string
1481
- enum: [low, medium, high, critical]
1482
- description: Risk level of the original unsafe DDL.
1483
- findings:
1484
- type: array
1485
- items:
1486
- $ref: '#/components/schemas/AgentFinding'
1487
- description: Issues found in the original migration.
1488
- phases:
1489
- type: array
1490
- items:
1491
- type: object
1492
- required: [name, sql, description]
1493
- properties:
1494
- name:
1495
- type: string
1496
- enum: [expand, backfill, switch, contract]
1497
- sql:
1498
- type: string
1499
- description: SQL content for this phase.
1500
- description:
1501
- type: string
1502
- description: Human-readable description of what this phase does.
1503
- deploymentGate:
1504
- type: string
1505
- description: Gate condition to verify before proceeding to next phase.
1506
- description: Ordered list of migration phases.
1507
- recommendedActions:
1508
- type: array
1509
- items:
1510
- $ref: '#/components/schemas/AgentRecommendedAction'
1511
- metadata:
1512
- type: object
1379
+ allOf:
1380
+ - $ref: 'components.yaml#/schemas/agent-audit-result'
1381
+ - type: object
1382
+ required: [phases]
1513
1383
  properties:
1514
- tool:
1515
- type: string
1516
- command:
1517
- type: string
1518
- version:
1519
- type: string
1520
- generatedAt:
1521
- type: string
1522
- adapter:
1384
+ summary:
1523
1385
  type: string
1524
- model:
1386
+ description: Overview of the proposed decomposition.
1387
+ riskLevel:
1525
1388
  type: string
1389
+ enum: [low, medium, high, critical]
1390
+ description: Risk level of the original unsafe DDL.
1391
+ findings:
1392
+ type: array
1393
+ items:
1394
+ $ref: '#/components/schemas/AgentFinding'
1395
+ description: Issues found in the original migration.
1396
+ phases:
1397
+ type: array
1398
+ items:
1399
+ type: object
1400
+ required: [name, sql, description]
1401
+ properties:
1402
+ name:
1403
+ type: string
1404
+ enum: [expand, backfill, switch, contract]
1405
+ sql:
1406
+ type: string
1407
+ description: SQL content for this phase.
1408
+ description:
1409
+ type: string
1410
+ description: Human-readable description of what this phase does.
1411
+ deploymentGate:
1412
+ type: string
1413
+ description: Gate condition to verify before proceeding to next phase.
1414
+ description: Ordered list of migration phases.
1526
1415
 
1527
1416
  ExplainResult:
1528
1417
  type: object
1529
1418
  description: >-
1530
1419
  Result from explain command. Contains a human-readable explanation
1531
1420
  of another command's output, suitable for PR comments or release decisions.
1532
- required: [summary, riskLevel, findings, explanation]
1533
- properties:
1534
- summary:
1535
- type: string
1536
- description: One-line summary for quick scanning.
1537
- riskLevel:
1538
- type: string
1539
- enum: [low, medium, high, critical]
1540
- description: Assessed urgency of the underlying issue.
1541
- explanation:
1542
- type: string
1543
- description: >-
1544
- Multi-paragraph human-readable explanation in Markdown format.
1545
- Written for non-DBA audiences.
1546
- findings:
1547
- type: array
1548
- items:
1549
- $ref: '#/components/schemas/AgentFinding'
1550
- description: Key points extracted from the command output.
1551
- recommendedActions:
1552
- type: array
1553
- items:
1554
- $ref: '#/components/schemas/AgentRecommendedAction'
1555
- description: Concrete next steps for the reader.
1556
- sourceCommand:
1557
- type: string
1558
- description: The command that produced the input (e.g. "migraguard lint").
1559
- metadata:
1560
- type: object
1421
+ allOf:
1422
+ - $ref: 'components.yaml#/schemas/agent-audit-result'
1423
+ - type: object
1424
+ required: [explanation]
1561
1425
  properties:
1562
- tool:
1563
- type: string
1564
- command:
1565
- type: string
1566
- version:
1426
+ summary:
1567
1427
  type: string
1568
- generatedAt:
1428
+ description: One-line summary for quick scanning.
1429
+ riskLevel:
1569
1430
  type: string
1570
- adapter:
1431
+ enum: [low, medium, high, critical]
1432
+ description: Assessed urgency of the underlying issue.
1433
+ explanation:
1571
1434
  type: string
1572
- model:
1435
+ description: >-
1436
+ Multi-paragraph human-readable explanation in Markdown format.
1437
+ Written for non-DBA audiences.
1438
+ findings:
1439
+ type: array
1440
+ items:
1441
+ $ref: '#/components/schemas/AgentFinding'
1442
+ description: Key points extracted from the command output.
1443
+ recommendedActions:
1444
+ type: array
1445
+ items:
1446
+ $ref: '#/components/schemas/AgentRecommendedAction'
1447
+ description: Concrete next steps for the reader.
1448
+ sourceCommand:
1573
1449
  type: string
1450
+ description: The command that produced the input (e.g. "migraguard lint").
@@ -337,6 +337,15 @@ Executes pg_dump (PostgreSQL), mysqldump (MySQL), or sqlite3 .schema (SQLite) to
337
337
  ```
338
338
  migraguard dump
339
339
  ```
340
+ ```
341
+ migraguard dump --dry-run
342
+ ```
343
+
344
+ #### Options
345
+
346
+ | Option | Aliases | Required | Default | Description |
347
+ |---|---|---|---|---|
348
+ | `--dry-run` | -n | No | `false` | Output normalized schema to stdout without writing schema.sql. |
340
349
 
341
350
  #### Exit Codes
342
351
 
@@ -362,6 +371,7 @@ x-agent:
362
371
  - database_read
363
372
  - file_write
364
373
  sideEffectNote: Reads DB schema via pg_dump/mysqldump and writes normalized output to schema.sql.
374
+ safeDryRunOption: dry-run
365
375
  expectedDurationMs: 10000
366
376
  retryableExitCodes:
367
377
  - 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "migraguard",
3
- "version": "0.9.2",
3
+ "version": "0.10.1",
4
4
  "description": "PostgreSQL schema-aware deployment control — idempotent SQL migrations with CI-enforced integrity checks, expand/contract migration orchestration, schema drift detection, and unified gating across database, application, and infrastructure rollouts",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,7 +57,7 @@
57
57
  "deployment-gate"
58
58
  ],
59
59
  "peerDependencies": {
60
- "agent-contracts-runtime": ">=0.12.0",
60
+ "agent-contracts-runtime": ">=0.13.0",
61
61
  "better-sqlite3": ">=11.0.0",
62
62
  "mysql2": ">=3.0.0"
63
63
  },
@@ -94,8 +94,8 @@
94
94
  "@typescript-eslint/eslint-plugin": "^8.54.0",
95
95
  "@typescript-eslint/parser": "^8.54.0",
96
96
  "agent-contracts": "^0.17.1",
97
- "agent-contracts-runtime": "^0.12.1",
98
- "cli-contracts": "^0.5.2",
97
+ "agent-contracts-runtime": "^0.13.0",
98
+ "cli-contracts": "^0.6.0",
99
99
  "eslint": "^9.39.2",
100
100
  "tsup": "^8.0.1",
101
101
  "typescript": "^5.3.3",