@gitgov/core 1.8.3 → 1.10.0
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/dist/src/index.d.ts +168 -21
- package/dist/src/index.js +85 -2
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ interface ActorRecord {
|
|
|
54
54
|
/**
|
|
55
55
|
* Canonical schema for agent operational manifests.
|
|
56
56
|
*/
|
|
57
|
-
interface AgentRecord {
|
|
57
|
+
interface AgentRecord<TMetadata = object> {
|
|
58
58
|
/**
|
|
59
59
|
* Unique identifier for the agent, linking to an ActorRecord.
|
|
60
60
|
*/
|
|
@@ -87,9 +87,7 @@ interface AgentRecord {
|
|
|
87
87
|
* This field does NOT affect agent execution - it is purely informational.
|
|
88
88
|
*
|
|
89
89
|
*/
|
|
90
|
-
metadata?:
|
|
91
|
-
[k: string]: unknown | undefined;
|
|
92
|
-
};
|
|
90
|
+
metadata?: TMetadata;
|
|
93
91
|
engine: {
|
|
94
92
|
type: 'local';
|
|
95
93
|
/**
|
|
@@ -274,7 +272,7 @@ interface CycleRecord {
|
|
|
274
272
|
/**
|
|
275
273
|
* Canonical schema for execution log records - the universal event stream
|
|
276
274
|
*/
|
|
277
|
-
interface ExecutionRecord {
|
|
275
|
+
interface ExecutionRecord<TMetadata = object> {
|
|
278
276
|
/**
|
|
279
277
|
* Unique identifier for the execution log entry (10 timestamp + 1 dash + 4 'exec' + 1 dash + max 50 slug = 66 max)
|
|
280
278
|
*/
|
|
@@ -317,6 +315,15 @@ interface ExecutionRecord {
|
|
|
317
315
|
*
|
|
318
316
|
*/
|
|
319
317
|
references?: string[];
|
|
318
|
+
/**
|
|
319
|
+
* Optional structured data for machine consumption.
|
|
320
|
+
* Use this field for data that needs to be programmatically processed (e.g., audit findings,
|
|
321
|
+
* performance metrics, scan results). This complements result (human-readable WHAT) and
|
|
322
|
+
* notes (narrative HOW/WHY) by providing structured, queryable data.
|
|
323
|
+
* Common use cases: audit findings arrays, performance metrics, tool outputs, scan summaries.
|
|
324
|
+
*
|
|
325
|
+
*/
|
|
326
|
+
metadata?: TMetadata;
|
|
320
327
|
}
|
|
321
328
|
|
|
322
329
|
/**
|
|
@@ -327,7 +334,7 @@ interface ExecutionRecord {
|
|
|
327
334
|
/**
|
|
328
335
|
* Canonical schema for feedback records - structured conversation about work
|
|
329
336
|
*/
|
|
330
|
-
interface FeedbackRecord {
|
|
337
|
+
interface FeedbackRecord<TMetadata = object> {
|
|
331
338
|
/**
|
|
332
339
|
* Unique identifier for the feedback entry
|
|
333
340
|
*/
|
|
@@ -370,6 +377,13 @@ interface FeedbackRecord {
|
|
|
370
377
|
* Optional. The ID of another feedback record that this one resolves or responds to
|
|
371
378
|
*/
|
|
372
379
|
resolvesFeedbackId?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Optional structured data for machine consumption.
|
|
382
|
+
* Use this field for domain-specific data that needs to be programmatically processed.
|
|
383
|
+
* Common use cases: waiver details (fingerprint, ruleId, file, line), approval context, assignment metadata.
|
|
384
|
+
*
|
|
385
|
+
*/
|
|
386
|
+
metadata?: TMetadata;
|
|
373
387
|
}
|
|
374
388
|
|
|
375
389
|
/**
|
|
@@ -754,7 +768,7 @@ declare class GitGovError extends Error {
|
|
|
754
768
|
type index$m_ActorPayload = ActorPayload;
|
|
755
769
|
type index$m_ActorRecord = ActorRecord;
|
|
756
770
|
type index$m_AgentPayload = AgentPayload;
|
|
757
|
-
type index$m_AgentRecord = AgentRecord
|
|
771
|
+
type index$m_AgentRecord<TMetadata = object> = AgentRecord<TMetadata>;
|
|
758
772
|
type index$m_ChangelogPayload = ChangelogPayload;
|
|
759
773
|
type index$m_ChangelogRecord = ChangelogRecord;
|
|
760
774
|
type index$m_CustomRecord = CustomRecord;
|
|
@@ -763,9 +777,9 @@ type index$m_CycleRecord = CycleRecord;
|
|
|
763
777
|
type index$m_EmbeddedMetadataHeader = EmbeddedMetadataHeader;
|
|
764
778
|
type index$m_EmbeddedMetadataRecord<T extends GitGovRecordPayload> = EmbeddedMetadataRecord<T>;
|
|
765
779
|
type index$m_ExecutionPayload = ExecutionPayload;
|
|
766
|
-
type index$m_ExecutionRecord = ExecutionRecord
|
|
780
|
+
type index$m_ExecutionRecord<TMetadata = object> = ExecutionRecord<TMetadata>;
|
|
767
781
|
type index$m_FeedbackPayload = FeedbackPayload;
|
|
768
|
-
type index$m_FeedbackRecord = FeedbackRecord
|
|
782
|
+
type index$m_FeedbackRecord<TMetadata = object> = FeedbackRecord<TMetadata>;
|
|
769
783
|
type index$m_GitGovActorRecord = GitGovActorRecord;
|
|
770
784
|
type index$m_GitGovAgentRecord = GitGovAgentRecord;
|
|
771
785
|
type index$m_GitGovChangelogRecord = GitGovChangelogRecord;
|
|
@@ -3756,12 +3770,23 @@ declare function createCycleRecord(payload: Partial<CycleRecord>): CycleRecord;
|
|
|
3756
3770
|
declare function loadCycleRecord(data: unknown): GitGovCycleRecord;
|
|
3757
3771
|
|
|
3758
3772
|
/**
|
|
3759
|
-
* Creates a complete ExecutionRecord with validation
|
|
3773
|
+
* Creates a complete ExecutionRecord with validation.
|
|
3774
|
+
*
|
|
3775
|
+
* The factory is generic to preserve the metadata type for compile-time safety.
|
|
3776
|
+
*
|
|
3777
|
+
* @param payload - Partial ExecutionRecord payload with optional typed metadata
|
|
3778
|
+
* @returns ExecutionRecord<TMetadata> - The validated ExecutionRecord with preserved metadata type
|
|
3760
3779
|
*
|
|
3761
|
-
* @
|
|
3762
|
-
*
|
|
3780
|
+
* @example
|
|
3781
|
+
* interface AuditMetadata { scannedFiles: number; }
|
|
3782
|
+
* const record = createExecutionRecord<AuditMetadata>({
|
|
3783
|
+
* taskId: '1752274500-task-audit',
|
|
3784
|
+
* result: 'Audit complete',
|
|
3785
|
+
* metadata: { scannedFiles: 245 }
|
|
3786
|
+
* });
|
|
3787
|
+
* // record.metadata?.scannedFiles is typed as number
|
|
3763
3788
|
*/
|
|
3764
|
-
declare function createExecutionRecord(payload: Partial<ExecutionRecord
|
|
3789
|
+
declare function createExecutionRecord<TMetadata extends object = object>(payload: Partial<ExecutionRecord<TMetadata>>): ExecutionRecord<TMetadata>;
|
|
3765
3790
|
/**
|
|
3766
3791
|
* Loads and validates an existing ExecutionRecord from untrusted data.
|
|
3767
3792
|
* Used by RecordStore to validate records when reading from disk.
|
|
@@ -3792,12 +3817,14 @@ declare function createChangelogRecord(payload: Partial<ChangelogRecord>): Chang
|
|
|
3792
3817
|
declare function loadChangelogRecord(data: unknown): GitGovChangelogRecord;
|
|
3793
3818
|
|
|
3794
3819
|
/**
|
|
3795
|
-
* Creates a complete FeedbackRecord with validation
|
|
3820
|
+
* Creates a complete FeedbackRecord with validation.
|
|
3821
|
+
*
|
|
3822
|
+
* The factory is generic to preserve the metadata type for compile-time safety.
|
|
3796
3823
|
*
|
|
3797
|
-
* @param payload - Partial FeedbackRecord payload
|
|
3798
|
-
* @returns FeedbackRecord - The validated FeedbackRecord
|
|
3824
|
+
* @param payload - Partial FeedbackRecord payload with optional typed metadata
|
|
3825
|
+
* @returns FeedbackRecord<TMetadata> - The validated FeedbackRecord with preserved metadata type
|
|
3799
3826
|
*/
|
|
3800
|
-
declare function createFeedbackRecord(payload: Partial<FeedbackRecord
|
|
3827
|
+
declare function createFeedbackRecord<TMetadata extends object = object>(payload: Partial<FeedbackRecord<TMetadata>>): FeedbackRecord<TMetadata>;
|
|
3801
3828
|
/**
|
|
3802
3829
|
* Loads and validates an existing FeedbackRecord from untrusted data.
|
|
3803
3830
|
* Used by RecordStore to validate records when reading from disk.
|
|
@@ -5675,8 +5702,29 @@ declare const Schemas: {
|
|
|
5675
5702
|
default: never[];
|
|
5676
5703
|
description: string;
|
|
5677
5704
|
};
|
|
5705
|
+
metadata: {
|
|
5706
|
+
type: string;
|
|
5707
|
+
additionalProperties: boolean;
|
|
5708
|
+
description: string;
|
|
5709
|
+
examples: ({
|
|
5710
|
+
findings: {
|
|
5711
|
+
type: string;
|
|
5712
|
+
file: string;
|
|
5713
|
+
line: number;
|
|
5714
|
+
}[];
|
|
5715
|
+
scannedFiles: number;
|
|
5716
|
+
metrics?: never;
|
|
5717
|
+
} | {
|
|
5718
|
+
metrics: {
|
|
5719
|
+
duration_ms: number;
|
|
5720
|
+
memory_mb: number;
|
|
5721
|
+
};
|
|
5722
|
+
findings?: never;
|
|
5723
|
+
scannedFiles?: never;
|
|
5724
|
+
})[];
|
|
5725
|
+
};
|
|
5678
5726
|
};
|
|
5679
|
-
examples: {
|
|
5727
|
+
examples: ({
|
|
5680
5728
|
id: string;
|
|
5681
5729
|
taskId: string;
|
|
5682
5730
|
type: string;
|
|
@@ -5684,7 +5732,34 @@ declare const Schemas: {
|
|
|
5684
5732
|
result: string;
|
|
5685
5733
|
notes: string;
|
|
5686
5734
|
references: string[];
|
|
5687
|
-
|
|
5735
|
+
metadata?: never;
|
|
5736
|
+
} | {
|
|
5737
|
+
id: string;
|
|
5738
|
+
taskId: string;
|
|
5739
|
+
type: string;
|
|
5740
|
+
title: string;
|
|
5741
|
+
result: string;
|
|
5742
|
+
notes: string;
|
|
5743
|
+
references: string[];
|
|
5744
|
+
metadata: {
|
|
5745
|
+
scannedFiles: number;
|
|
5746
|
+
scannedLines: number;
|
|
5747
|
+
duration_ms: number;
|
|
5748
|
+
findings: {
|
|
5749
|
+
id: string;
|
|
5750
|
+
severity: string;
|
|
5751
|
+
file: string;
|
|
5752
|
+
line: number;
|
|
5753
|
+
type: string;
|
|
5754
|
+
}[];
|
|
5755
|
+
summary: {
|
|
5756
|
+
critical: number;
|
|
5757
|
+
high: number;
|
|
5758
|
+
medium: number;
|
|
5759
|
+
low: number;
|
|
5760
|
+
};
|
|
5761
|
+
};
|
|
5762
|
+
})[];
|
|
5688
5763
|
};
|
|
5689
5764
|
readonly FeedbackRecord: {
|
|
5690
5765
|
$schema: string;
|
|
@@ -5745,6 +5820,18 @@ declare const Schemas: {
|
|
|
5745
5820
|
description: string;
|
|
5746
5821
|
examples: string[];
|
|
5747
5822
|
};
|
|
5823
|
+
metadata: {
|
|
5824
|
+
type: string;
|
|
5825
|
+
additionalProperties: boolean;
|
|
5826
|
+
description: string;
|
|
5827
|
+
examples: {
|
|
5828
|
+
fingerprint: string;
|
|
5829
|
+
ruleId: string;
|
|
5830
|
+
file: string;
|
|
5831
|
+
line: number;
|
|
5832
|
+
expiresAt: string;
|
|
5833
|
+
}[];
|
|
5834
|
+
};
|
|
5748
5835
|
};
|
|
5749
5836
|
examples: ({
|
|
5750
5837
|
id: string;
|
|
@@ -7459,8 +7546,29 @@ declare function getSchema(name: SchemaName): {
|
|
|
7459
7546
|
default: never[];
|
|
7460
7547
|
description: string;
|
|
7461
7548
|
};
|
|
7549
|
+
metadata: {
|
|
7550
|
+
type: string;
|
|
7551
|
+
additionalProperties: boolean;
|
|
7552
|
+
description: string;
|
|
7553
|
+
examples: ({
|
|
7554
|
+
findings: {
|
|
7555
|
+
type: string;
|
|
7556
|
+
file: string;
|
|
7557
|
+
line: number;
|
|
7558
|
+
}[];
|
|
7559
|
+
scannedFiles: number;
|
|
7560
|
+
metrics?: never;
|
|
7561
|
+
} | {
|
|
7562
|
+
metrics: {
|
|
7563
|
+
duration_ms: number;
|
|
7564
|
+
memory_mb: number;
|
|
7565
|
+
};
|
|
7566
|
+
findings?: never;
|
|
7567
|
+
scannedFiles?: never;
|
|
7568
|
+
})[];
|
|
7569
|
+
};
|
|
7462
7570
|
};
|
|
7463
|
-
examples: {
|
|
7571
|
+
examples: ({
|
|
7464
7572
|
id: string;
|
|
7465
7573
|
taskId: string;
|
|
7466
7574
|
type: string;
|
|
@@ -7468,7 +7576,34 @@ declare function getSchema(name: SchemaName): {
|
|
|
7468
7576
|
result: string;
|
|
7469
7577
|
notes: string;
|
|
7470
7578
|
references: string[];
|
|
7471
|
-
|
|
7579
|
+
metadata?: never;
|
|
7580
|
+
} | {
|
|
7581
|
+
id: string;
|
|
7582
|
+
taskId: string;
|
|
7583
|
+
type: string;
|
|
7584
|
+
title: string;
|
|
7585
|
+
result: string;
|
|
7586
|
+
notes: string;
|
|
7587
|
+
references: string[];
|
|
7588
|
+
metadata: {
|
|
7589
|
+
scannedFiles: number;
|
|
7590
|
+
scannedLines: number;
|
|
7591
|
+
duration_ms: number;
|
|
7592
|
+
findings: {
|
|
7593
|
+
id: string;
|
|
7594
|
+
severity: string;
|
|
7595
|
+
file: string;
|
|
7596
|
+
line: number;
|
|
7597
|
+
type: string;
|
|
7598
|
+
}[];
|
|
7599
|
+
summary: {
|
|
7600
|
+
critical: number;
|
|
7601
|
+
high: number;
|
|
7602
|
+
medium: number;
|
|
7603
|
+
low: number;
|
|
7604
|
+
};
|
|
7605
|
+
};
|
|
7606
|
+
})[];
|
|
7472
7607
|
} | {
|
|
7473
7608
|
$schema: string;
|
|
7474
7609
|
$id: string;
|
|
@@ -7528,6 +7663,18 @@ declare function getSchema(name: SchemaName): {
|
|
|
7528
7663
|
description: string;
|
|
7529
7664
|
examples: string[];
|
|
7530
7665
|
};
|
|
7666
|
+
metadata: {
|
|
7667
|
+
type: string;
|
|
7668
|
+
additionalProperties: boolean;
|
|
7669
|
+
description: string;
|
|
7670
|
+
examples: {
|
|
7671
|
+
fingerprint: string;
|
|
7672
|
+
ruleId: string;
|
|
7673
|
+
file: string;
|
|
7674
|
+
line: number;
|
|
7675
|
+
expiresAt: string;
|
|
7676
|
+
}[];
|
|
7677
|
+
};
|
|
7531
7678
|
};
|
|
7532
7679
|
examples: ({
|
|
7533
7680
|
id: string;
|
package/dist/src/index.js
CHANGED
|
@@ -1388,6 +1388,29 @@ var execution_record_schema_default = {
|
|
|
1388
1388
|
},
|
|
1389
1389
|
default: [],
|
|
1390
1390
|
description: "Optional list of typed references to relevant commits, files, PRs, or external documents.\nShould use typed prefixes for clarity and trazabilidad (see execution_protocol_appendix.md):\n- commit: Git commit SHA\n- pr: Pull Request number\n- file: File path (relative to repo root)\n- url: External URL\n- issue: GitHub Issue number\n- task: TaskRecord ID\n- exec: ExecutionRecord ID (for corrections or dependencies)\n- changelog: ChangelogRecord ID\n"
|
|
1391
|
+
},
|
|
1392
|
+
metadata: {
|
|
1393
|
+
type: "object",
|
|
1394
|
+
additionalProperties: true,
|
|
1395
|
+
description: "Optional structured data for machine consumption.\nUse this field for data that needs to be programmatically processed (e.g., audit findings,\nperformance metrics, scan results). This complements result (human-readable WHAT) and\nnotes (narrative HOW/WHY) by providing structured, queryable data.\nCommon use cases: audit findings arrays, performance metrics, tool outputs, scan summaries.\n",
|
|
1396
|
+
examples: [
|
|
1397
|
+
{
|
|
1398
|
+
findings: [
|
|
1399
|
+
{
|
|
1400
|
+
type: "PII",
|
|
1401
|
+
file: "src/user.ts",
|
|
1402
|
+
line: 42
|
|
1403
|
+
}
|
|
1404
|
+
],
|
|
1405
|
+
scannedFiles: 245
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
metrics: {
|
|
1409
|
+
duration_ms: 1250,
|
|
1410
|
+
memory_mb: 512
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
]
|
|
1391
1414
|
}
|
|
1392
1415
|
},
|
|
1393
1416
|
examples: [
|
|
@@ -1460,6 +1483,52 @@ var execution_record_schema_default = {
|
|
|
1460
1483
|
references: [
|
|
1461
1484
|
"exec:1752275500-exec-refactor-queries"
|
|
1462
1485
|
]
|
|
1486
|
+
},
|
|
1487
|
+
{
|
|
1488
|
+
id: "1752276000-exec-gdpr-audit-scan",
|
|
1489
|
+
taskId: "1752274500-task-gdpr-compliance",
|
|
1490
|
+
type: "analysis",
|
|
1491
|
+
title: "GDPR Audit Scan - 2025-01-15",
|
|
1492
|
+
result: "Escaneados 245 archivos. Encontrados 10 findings (3 critical, 4 high, 3 medium). Ver metadata para detalles estructurados.",
|
|
1493
|
+
notes: "Scan ejecutado con RegexDetector + HeuristicDetector. LLM calls: 0 (tier free).",
|
|
1494
|
+
references: [
|
|
1495
|
+
"file:src/config/db.ts",
|
|
1496
|
+
"file:src/auth/keys.ts"
|
|
1497
|
+
],
|
|
1498
|
+
metadata: {
|
|
1499
|
+
scannedFiles: 245,
|
|
1500
|
+
scannedLines: 18420,
|
|
1501
|
+
duration_ms: 1250,
|
|
1502
|
+
findings: [
|
|
1503
|
+
{
|
|
1504
|
+
id: "SEC-001",
|
|
1505
|
+
severity: "critical",
|
|
1506
|
+
file: "src/config/db.ts",
|
|
1507
|
+
line: 5,
|
|
1508
|
+
type: "api_key"
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
id: "SEC-003",
|
|
1512
|
+
severity: "critical",
|
|
1513
|
+
file: "src/auth/keys.ts",
|
|
1514
|
+
line: 2,
|
|
1515
|
+
type: "private_key"
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
id: "PII-003",
|
|
1519
|
+
severity: "critical",
|
|
1520
|
+
file: "src/payments/stripe.ts",
|
|
1521
|
+
line: 8,
|
|
1522
|
+
type: "credit_card"
|
|
1523
|
+
}
|
|
1524
|
+
],
|
|
1525
|
+
summary: {
|
|
1526
|
+
critical: 3,
|
|
1527
|
+
high: 4,
|
|
1528
|
+
medium: 3,
|
|
1529
|
+
low: 0
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1463
1532
|
}
|
|
1464
1533
|
]
|
|
1465
1534
|
};
|
|
@@ -1565,6 +1634,20 @@ var feedback_record_schema_default = {
|
|
|
1565
1634
|
examples: [
|
|
1566
1635
|
"1752788100-feedback-blocking-rest-api"
|
|
1567
1636
|
]
|
|
1637
|
+
},
|
|
1638
|
+
metadata: {
|
|
1639
|
+
type: "object",
|
|
1640
|
+
additionalProperties: true,
|
|
1641
|
+
description: "Optional structured data for machine consumption.\nUse this field for domain-specific data that needs to be programmatically processed.\nCommon use cases: waiver details (fingerprint, ruleId, file, line), approval context, assignment metadata.\n",
|
|
1642
|
+
examples: [
|
|
1643
|
+
{
|
|
1644
|
+
fingerprint: "abc123def456",
|
|
1645
|
+
ruleId: "PII-001",
|
|
1646
|
+
file: "src/user.ts",
|
|
1647
|
+
line: 42,
|
|
1648
|
+
expiresAt: "2025-12-31T23:59:59Z"
|
|
1649
|
+
}
|
|
1650
|
+
]
|
|
1568
1651
|
}
|
|
1569
1652
|
},
|
|
1570
1653
|
examples: [
|
|
@@ -4032,7 +4115,7 @@ function createFeedbackRecord(payload) {
|
|
|
4032
4115
|
content: payload.content || "",
|
|
4033
4116
|
assignee: payload.assignee,
|
|
4034
4117
|
resolvesFeedbackId: payload.resolvesFeedbackId,
|
|
4035
|
-
|
|
4118
|
+
metadata: payload.metadata
|
|
4036
4119
|
};
|
|
4037
4120
|
const validation = validateFeedbackRecordDetailed(feedback);
|
|
4038
4121
|
if (!validation.isValid) {
|
|
@@ -4320,7 +4403,7 @@ function createExecutionRecord(payload) {
|
|
|
4320
4403
|
title: payload.title,
|
|
4321
4404
|
notes: payload.notes,
|
|
4322
4405
|
references: payload.references,
|
|
4323
|
-
|
|
4406
|
+
metadata: payload.metadata
|
|
4324
4407
|
};
|
|
4325
4408
|
const validation = validateExecutionRecordDetailed(execution);
|
|
4326
4409
|
if (!validation.isValid) {
|