artifact-graph 0.12.0 → 0.14.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/CHANGELOG.md +33 -0
- package/CONTRIBUTING.md +1 -1
- package/INSTALL.md +1 -1
- package/README.md +126 -5
- package/README.zh-CN.md +128 -4
- package/contracts/restructure-mapping/schema.json +263 -0
- package/contracts/restructure-plan/schema.json +112 -0
- package/contracts/restructure-request/schema.json +48 -0
- package/dist/cli.js +2873 -412
- package/dist/index.cjs +2596 -253
- package/dist/index.d.cts +549 -3
- package/dist/index.d.ts +549 -3
- package/dist/index.js +2542 -247
- package/package.json +6 -3
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "artifact.restructure-mapping@1",
|
|
4
|
+
"title": "Artifact Contract: Restructure Mapping",
|
|
5
|
+
"version": "1.1.0",
|
|
6
|
+
"contractIdentity": {
|
|
7
|
+
"major": "artifact.restructure-mapping@1",
|
|
8
|
+
"authority": "artifact",
|
|
9
|
+
"namespace": "artifact",
|
|
10
|
+
"revisionDigest": "sha256:b3a7a52b4ab2479c97a53e754f57e3ec6bf71e7c81385e11666c015f54d7c414"
|
|
11
|
+
},
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": ["schema_version", "request", "request_digest", "config_snapshot", "sources", "targets", "content_moves", "identity_map", "criterion_map", "relation_map", "prose_edits", "file_headers", "unresolved"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"schema_version": { "const": "1.0" },
|
|
16
|
+
"request": { "$ref": "#/definitions/request" },
|
|
17
|
+
"request_digest": { "$ref": "#/definitions/digest" },
|
|
18
|
+
"config_snapshot": { "$ref": "#/definitions/snapshot" },
|
|
19
|
+
"sources": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"minItems": 1,
|
|
22
|
+
"items": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": ["type", "id", "path", "snapshot", "disposition"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"type": { "type": "string", "minLength": 1 },
|
|
27
|
+
"id": { "type": "string", "minLength": 1 },
|
|
28
|
+
"path": { "type": "string", "minLength": 1 },
|
|
29
|
+
"snapshot": { "$ref": "#/definitions/snapshot" },
|
|
30
|
+
"disposition": { "enum": ["preserved", "retired"] }
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"targets": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"required": ["key", "type", "id", "path", "snapshot"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"key": { "type": "string", "minLength": 1 },
|
|
42
|
+
"type": { "type": "string", "minLength": 1 },
|
|
43
|
+
"id": { "type": "string", "minLength": 1 },
|
|
44
|
+
"path": { "type": "string", "minLength": 1 },
|
|
45
|
+
"snapshot": { "$ref": "#/definitions/snapshot" }
|
|
46
|
+
},
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"content_moves": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"required": ["id", "source", "target"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"id": { "type": "string", "minLength": 1 },
|
|
57
|
+
"source": { "$ref": "#/definitions/span" },
|
|
58
|
+
"target": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"required": ["path", "order", "mode"],
|
|
61
|
+
"properties": {
|
|
62
|
+
"path": { "type": "string", "minLength": 1 },
|
|
63
|
+
"order": { "type": "integer", "minimum": 0 },
|
|
64
|
+
"mode": { "enum": ["move", "copy"] },
|
|
65
|
+
"separator": { "type": "string" }
|
|
66
|
+
},
|
|
67
|
+
"additionalProperties": false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"additionalProperties": false
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"identity_map": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"required": ["source_type", "source_id", "target_keys", "source_disposition"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"source_type": { "type": "string", "minLength": 1 },
|
|
80
|
+
"source_id": { "type": "string", "minLength": 1 },
|
|
81
|
+
"target_keys": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
|
|
82
|
+
"source_disposition": { "enum": ["preserved", "retired"] }
|
|
83
|
+
},
|
|
84
|
+
"additionalProperties": false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"criterion_map": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"items": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"required": ["source_feature", "source_criterion", "targets"],
|
|
92
|
+
"properties": {
|
|
93
|
+
"source_feature": { "type": "string", "minLength": 1 },
|
|
94
|
+
"source_criterion": { "type": "string", "pattern": "^AC[0-9]+$" },
|
|
95
|
+
"targets": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"minItems": 1,
|
|
98
|
+
"items": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"required": ["feature", "criterion"],
|
|
101
|
+
"properties": {
|
|
102
|
+
"feature": { "type": "string", "minLength": 1 },
|
|
103
|
+
"criterion": { "type": "string", "pattern": "^AC[0-9]+$" }
|
|
104
|
+
},
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": false
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"relation_map": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": ["occurrence", "targets", "basis"],
|
|
117
|
+
"properties": {
|
|
118
|
+
"occurrence": { "$ref": "#/definitions/relation" },
|
|
119
|
+
"targets": { "type": "array", "items": { "$ref": "#/definitions/relationTarget" } },
|
|
120
|
+
"basis": { "type": "string", "minLength": 1 }
|
|
121
|
+
},
|
|
122
|
+
"additionalProperties": false
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"prose_edits": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"required": ["source", "target_path", "old_text", "new_text", "reason"],
|
|
130
|
+
"properties": {
|
|
131
|
+
"source": { "$ref": "#/definitions/span" },
|
|
132
|
+
"target_path": { "type": "string", "minLength": 1 },
|
|
133
|
+
"old_text": { "type": "string" },
|
|
134
|
+
"new_text": { "type": "string" },
|
|
135
|
+
"reason": { "type": "string", "minLength": 1 }
|
|
136
|
+
},
|
|
137
|
+
"additionalProperties": false
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"file_headers": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"required": ["path", "content", "affected_records"],
|
|
145
|
+
"properties": {
|
|
146
|
+
"path": { "type": "string", "minLength": 1 },
|
|
147
|
+
"content": { "type": "string" },
|
|
148
|
+
"affected_records": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true }
|
|
149
|
+
},
|
|
150
|
+
"additionalProperties": false
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"unresolved": {
|
|
154
|
+
"type": "array",
|
|
155
|
+
"items": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"required": ["code", "message"],
|
|
158
|
+
"properties": {
|
|
159
|
+
"code": { "type": "string", "minLength": 1 },
|
|
160
|
+
"message": { "type": "string", "minLength": 1 },
|
|
161
|
+
"path": { "type": "string" },
|
|
162
|
+
"line": { "type": "integer", "minimum": 1 }
|
|
163
|
+
},
|
|
164
|
+
"additionalProperties": false
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"additionalProperties": false,
|
|
169
|
+
"definitions": {
|
|
170
|
+
"request": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"required": ["schema_version", "operation", "sources", "allowed_output_paths"],
|
|
173
|
+
"properties": {
|
|
174
|
+
"schema_version": { "const": "1.0" },
|
|
175
|
+
"operation": { "enum": ["record-split", "identity-split", "move-renumber"] },
|
|
176
|
+
"sources": {
|
|
177
|
+
"type": "array",
|
|
178
|
+
"minItems": 1,
|
|
179
|
+
"items": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"required": ["type", "id"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"type": { "type": "string", "minLength": 1 },
|
|
184
|
+
"id": { "type": "string", "minLength": 1 },
|
|
185
|
+
"path": { "type": "string", "minLength": 1 }
|
|
186
|
+
},
|
|
187
|
+
"additionalProperties": false
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"allowed_output_paths": {
|
|
191
|
+
"type": "array",
|
|
192
|
+
"minItems": 1,
|
|
193
|
+
"items": { "type": "string", "minLength": 1 },
|
|
194
|
+
"uniqueItems": true
|
|
195
|
+
},
|
|
196
|
+
"numbering_policy": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"required": ["mode"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"mode": { "enum": ["explicit", "configured-next-available"] },
|
|
201
|
+
"range": { "type": "string", "minLength": 1 }
|
|
202
|
+
},
|
|
203
|
+
"additionalProperties": false
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"additionalProperties": false
|
|
207
|
+
},
|
|
208
|
+
"digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
209
|
+
"mode": {
|
|
210
|
+
"anyOf": [
|
|
211
|
+
{ "type": "integer", "minimum": 0, "maximum": 511 },
|
|
212
|
+
{ "type": "null" }
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
"snapshot": {
|
|
216
|
+
"type": "object",
|
|
217
|
+
"required": ["path", "exists", "sha256", "size", "mode"],
|
|
218
|
+
"properties": {
|
|
219
|
+
"path": { "type": "string" },
|
|
220
|
+
"exists": { "type": "boolean" },
|
|
221
|
+
"sha256": { "anyOf": [{ "$ref": "#/definitions/digest" }, { "type": "null" }] },
|
|
222
|
+
"size": { "type": "integer", "minimum": 0 },
|
|
223
|
+
"mode": { "$ref": "#/definitions/mode" }
|
|
224
|
+
},
|
|
225
|
+
"additionalProperties": false
|
|
226
|
+
},
|
|
227
|
+
"span": {
|
|
228
|
+
"type": "object",
|
|
229
|
+
"required": ["path", "start_byte", "end_byte", "sha256"],
|
|
230
|
+
"properties": {
|
|
231
|
+
"path": { "type": "string", "minLength": 1 },
|
|
232
|
+
"start_byte": { "type": "integer", "minimum": 0 },
|
|
233
|
+
"end_byte": { "type": "integer", "minimum": 0 },
|
|
234
|
+
"sha256": { "$ref": "#/definitions/digest" }
|
|
235
|
+
},
|
|
236
|
+
"additionalProperties": false
|
|
237
|
+
},
|
|
238
|
+
"relation": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"required": ["from", "to", "kind", "source", "source_path", "source_line", "occurrence"],
|
|
241
|
+
"properties": {
|
|
242
|
+
"from": { "type": "string", "minLength": 1 },
|
|
243
|
+
"to": { "type": "string", "minLength": 1 },
|
|
244
|
+
"kind": { "type": "string", "minLength": 1 },
|
|
245
|
+
"source": { "type": "string", "minLength": 1 },
|
|
246
|
+
"source_path": { "type": "string", "minLength": 1 },
|
|
247
|
+
"source_line": { "type": "integer", "minimum": 1 },
|
|
248
|
+
"occurrence": { "type": "integer", "minimum": 1 }
|
|
249
|
+
},
|
|
250
|
+
"additionalProperties": false
|
|
251
|
+
},
|
|
252
|
+
"relationTarget": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"required": ["from", "to", "kind"],
|
|
255
|
+
"properties": {
|
|
256
|
+
"from": { "type": "string", "minLength": 1 },
|
|
257
|
+
"to": { "type": "string", "minLength": 1 },
|
|
258
|
+
"kind": { "type": "string", "minLength": 1 }
|
|
259
|
+
},
|
|
260
|
+
"additionalProperties": false
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "artifact.restructure-plan@1",
|
|
4
|
+
"title": "Artifact Contract: Restructure Plan",
|
|
5
|
+
"version": "1.1.0",
|
|
6
|
+
"contractIdentity": {
|
|
7
|
+
"major": "artifact.restructure-plan@1",
|
|
8
|
+
"authority": "artifact",
|
|
9
|
+
"namespace": "artifact",
|
|
10
|
+
"revisionDigest": "sha256:afaf8c75738b4c4caf613ad4cabdb9b8423b646b2db799cf345d6de9c5869283"
|
|
11
|
+
},
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": ["schema_version", "operation_id", "validation_timeout_ms", "request_digest", "mapping_digest", "config_snapshot", "input_snapshots", "candidates", "graph_diff", "validation", "applicable"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"schema_version": { "const": "1.1" },
|
|
16
|
+
"operation_id": { "$ref": "#/definitions/operationId" },
|
|
17
|
+
"validation_timeout_ms": { "const": 30000 },
|
|
18
|
+
"request_digest": { "$ref": "#/definitions/digest" },
|
|
19
|
+
"mapping_digest": { "$ref": "#/definitions/digest" },
|
|
20
|
+
"config_snapshot": { "$ref": "#/definitions/snapshot" },
|
|
21
|
+
"input_snapshots": { "type": "array", "items": { "$ref": "#/definitions/snapshot" } },
|
|
22
|
+
"candidates": {
|
|
23
|
+
"type": "array",
|
|
24
|
+
"items": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"required": ["path", "action", "content", "sha256", "mode", "original", "diff"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"path": { "type": "string", "minLength": 1 },
|
|
29
|
+
"action": { "enum": ["create", "replace", "delete"] },
|
|
30
|
+
"content": { "anyOf": [{ "type": "string" }, { "type": "null" }] },
|
|
31
|
+
"sha256": { "anyOf": [{ "$ref": "#/definitions/digest" }, { "type": "null" }] },
|
|
32
|
+
"mode": { "$ref": "#/definitions/mode" },
|
|
33
|
+
"original": { "$ref": "#/definitions/snapshot" },
|
|
34
|
+
"diff": { "type": "string" }
|
|
35
|
+
},
|
|
36
|
+
"additionalProperties": false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"graph_diff": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": ["added_nodes", "removed_nodes", "added_edges", "removed_edges"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"added_nodes": { "type": "array", "items": { "type": "string" } },
|
|
44
|
+
"removed_nodes": { "type": "array", "items": { "type": "string" } },
|
|
45
|
+
"added_edges": { "type": "array", "items": { "type": "string" } },
|
|
46
|
+
"removed_edges": { "type": "array", "items": { "type": "string" } }
|
|
47
|
+
},
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
50
|
+
"validation": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"required": ["blockers", "unresolved", "candidate_issues", "consumer_candidates"],
|
|
53
|
+
"properties": {
|
|
54
|
+
"blockers": { "type": "array", "items": { "$ref": "#/definitions/finding" } },
|
|
55
|
+
"unresolved": { "type": "array", "items": { "$ref": "#/definitions/finding" } },
|
|
56
|
+
"candidate_issues": { "type": "array", "items": { "type": "object" } },
|
|
57
|
+
"consumer_candidates": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["path", "line", "reference"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"path": { "type": "string", "minLength": 1 },
|
|
64
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
65
|
+
"reference": { "type": "string", "minLength": 1 }
|
|
66
|
+
},
|
|
67
|
+
"additionalProperties": false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
},
|
|
73
|
+
"applicable": { "type": "boolean" }
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false,
|
|
76
|
+
"definitions": {
|
|
77
|
+
"digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
|
|
78
|
+
"operationId": {
|
|
79
|
+
"type": "string",
|
|
80
|
+
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
81
|
+
},
|
|
82
|
+
"mode": {
|
|
83
|
+
"anyOf": [
|
|
84
|
+
{ "type": "integer", "minimum": 0, "maximum": 511 },
|
|
85
|
+
{ "type": "null" }
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"snapshot": {
|
|
89
|
+
"type": "object",
|
|
90
|
+
"required": ["path", "exists", "sha256", "size", "mode"],
|
|
91
|
+
"properties": {
|
|
92
|
+
"path": { "type": "string" },
|
|
93
|
+
"exists": { "type": "boolean" },
|
|
94
|
+
"sha256": { "anyOf": [{ "$ref": "#/definitions/digest" }, { "type": "null" }] },
|
|
95
|
+
"size": { "type": "integer", "minimum": 0 },
|
|
96
|
+
"mode": { "$ref": "#/definitions/mode" }
|
|
97
|
+
},
|
|
98
|
+
"additionalProperties": false
|
|
99
|
+
},
|
|
100
|
+
"finding": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"required": ["code", "message"],
|
|
103
|
+
"properties": {
|
|
104
|
+
"code": { "type": "string", "minLength": 1 },
|
|
105
|
+
"message": { "type": "string", "minLength": 1 },
|
|
106
|
+
"path": { "type": "string" },
|
|
107
|
+
"line": { "type": "integer", "minimum": 1 }
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "artifact.restructure-request@1",
|
|
4
|
+
"title": "Artifact Contract: Restructure Request",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"contractIdentity": {
|
|
7
|
+
"major": "artifact.restructure-request@1",
|
|
8
|
+
"authority": "artifact",
|
|
9
|
+
"namespace": "artifact",
|
|
10
|
+
"revisionDigest": "sha256:a8daeb76c2107a5516f8900b57f28425ecf89b4e76d95a64e7b705c773fed7bd"
|
|
11
|
+
},
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": ["schema_version", "operation", "sources", "allowed_output_paths"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"schema_version": { "const": "1.0" },
|
|
16
|
+
"operation": { "enum": ["record-split", "identity-split", "move-renumber"] },
|
|
17
|
+
"sources": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"minItems": 1,
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": ["type", "id"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"type": { "type": "string", "minLength": 1 },
|
|
25
|
+
"id": { "type": "string", "minLength": 1 },
|
|
26
|
+
"path": { "type": "string", "minLength": 1 }
|
|
27
|
+
},
|
|
28
|
+
"additionalProperties": false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"allowed_output_paths": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"minItems": 1,
|
|
34
|
+
"items": { "type": "string", "minLength": 1 },
|
|
35
|
+
"uniqueItems": true
|
|
36
|
+
},
|
|
37
|
+
"numbering_policy": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"required": ["mode"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"mode": { "enum": ["explicit", "configured-next-available"] },
|
|
42
|
+
"range": { "type": "string", "minLength": 1 }
|
|
43
|
+
},
|
|
44
|
+
"additionalProperties": false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
}
|