artifact-graph 0.15.0 → 0.16.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 CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.16.0
6
+
7
+ ### Added
8
+
9
+ - `loadConfig` and `artifact-graph doctor` diagnose declared graph-config field structure and types. A `statuses` value that should be a string array is rejected with a field path. Unknown top-level keys stay compatible and produce a locatable warning; they are not rejected as a class. `allowedEdges` is required on an existing config. `[]`, `null`, or a YAML empty value adopts the filled built-in `DEFAULT_SCHEMA.allowedEdges`. A non-empty list replaces the default table and is a strict from/to/kind whitelist; relations outside it are `DISALLOWED_EDGE`. `forbiddenEdges` still reports `FORBIDDEN_EDGE` first. A missing config file stays unconnected. `extraFields` remains optional index metadata.
10
+ - The package ships the official `artifact.spec@1` Markdown semantic-marker contract at `contracts/spec/schema.json`. `artifact-graph contract explain --contract artifact.spec@1` reports `identity`, `revisionDigest`, and `semanticMarkers`. `artifact-graph contract validate-markers` checks a complete SPEC Markdown file for the required markers `changes`, `scope`, and `acceptance`, and accepts the optional markers `acceptance-record` and `archive-record`. `contract validate` remains JSON-instance validation and does not substitute for Markdown marker checks. Unknown, undefined, empty, or optional-only marker sets are not a mechanical pass.
11
+
12
+ ### Breaking Changes
13
+
14
+ - Existing configs that omit `allowedEdges` now fail. `loadConfig` and `doctor` report a field-path diagnostic; the config does not load until the field is declared.
15
+ - A non-empty `allowedEdges` list is now a strict from/to/kind whitelist. Relations outside that list are `DISALLOWED_EDGE` and fail validation. Previous releases accepted those relations unless `forbiddenEdges` matched.
16
+ - `[]`, `null`, or a YAML empty `allowedEdges` value adopts the filled built-in `DEFAULT_SCHEMA.allowedEdges`. Custom project relations are not in that table unless the project writes them after analysing its own artifacts.
17
+ - Migration: declare `allowedEdges` explicitly. Use an empty value only when the built-in default table is the intended contract. After project analysis, write a precise non-empty from/to/kind list for custom relations. Do not copy every scanned edge into the list as a pass-through. `forbiddenEdges` still reports `FORBIDDEN_EDGE` first.
18
+ - Standing parent release policy maps breaking API changes to a major version (for example `0.9.0` → `1.0.0`). This release keeps `0.16.0` as a one-release maintainer exception and records the incompatible behavior. The standing major-version policy is unchanged.
19
+
20
+ ### Changed
21
+
22
+ - Version lockstep with `artifact-chain-assistant` 0.16.0.
23
+
5
24
  ## 0.15.0
6
25
 
7
26
  ### Added
package/INSTALL.md CHANGED
@@ -379,6 +379,15 @@ With `false`, `resolveArtifactContext` skips baseline injection entirely. No `ba
379
379
  appears in the context manifest, and the manifest writes `baselinePolicy: false` so that
380
380
  packet validation (`validatePacket`) correctly allows `requiredBaseline.total=0`.
381
381
 
382
+ ### Allowed edges
383
+
384
+ Existing `artifact-graph.config.yaml` files must declare `allowedEdges`. Use `[]`, `null`, or a YAML empty value to adopt the built-in `DEFAULT_SCHEMA.allowedEdges`. A non-empty list replaces that table and is a strict from/to/kind whitelist. Relations outside the effective list fail `validate` with `DISALLOWED_EDGE`. `forbiddenEdges` still wins. A missing file stays unconnected; `init` writes the filled default table.
385
+
386
+ ```yaml
387
+ # artifact-graph.config.yaml
388
+ allowedEdges: []
389
+ ```
390
+
382
391
  ### Config validation
383
392
 
384
393
  `loadConfig` rejects non-boolean values for `context.universal_baseline`:
package/README.md CHANGED
@@ -99,6 +99,8 @@ The only approved `project_standards` key is `skill-plugin`. It `extends` `commo
99
99
 
100
100
  The target project's `artifact-graph.config.yaml` owns adoption. Types already declared in that config or in existing method bindings stay, including extra types that are not on the published lists.
101
101
 
102
+ `loadConfig` and `artifact-graph doctor` diagnose declared field structure and types. A `statuses` value that should be a string array is rejected with a field path. Unknown top-level keys stay compatible and produce a locatable warning; they are not rejected as a class. `allowedEdges` is required on an existing config file. `[]`, `null`, or a YAML empty value adopts the built-in `DEFAULT_SCHEMA.allowedEdges`. A non-empty list replaces that table and is a strict from/to/kind whitelist; relations outside it are `DISALLOWED_EDGE`. `forbiddenEdges` still reports `FORBIDDEN_EDGE` first. A missing config file stays unconnected and is not turned into a valid project. `extraFields` remains optional index metadata. Markdown body contracts are not validated by `contract validate` in this round.
103
+
102
104
  ### JSON originals for custom types
103
105
 
104
106
  Built-in types keep their dedicated parsers. `format: json` belongs only on a custom type registered by the project, and that type must also set `idField`. Omitting `format` keeps Markdown parsing. A `*.json` scan path does not switch parsers until the type declares `format: json`.
@@ -111,7 +113,7 @@ Relations stay in `relationSemantics`, using the existing `kind`, `fields`, `tar
111
113
 
112
114
  A dot only separates exact property names. `*`, filters, JSONPath, and expressions are not path syntax in this batch. Records inside an array stay in the original object. This batch reads the id and configured relations; it does not select a title or status, and it does not join, prefix, or rewrite ids. Markdown fields are still looked up as one literal string. Diagnostics use line 1 because this batch does not map JSON tokens to source lines.
113
115
 
114
- A project can point a method at a capability and a release record at a method. The configuration below shows those two directions.
116
+ A project can point a method at a capability and a release record at a method. The configuration below shows those two directions. A non-empty `allowedEdges` list replaces the built-in default table, so the two project relations must be listed; `[]` does not authorize these custom-type relations.
115
117
 
116
118
  ```yaml
117
119
  types:
@@ -140,6 +142,9 @@ relationSemantics:
140
142
  label: Release record points to method
141
143
  targetTypes: [method]
142
144
  fields: [methods]
145
+ allowedEdges:
146
+ - { from: method, to: capability, kind: applies }
147
+ - { from: skill_release, to: method, kind: releases }
143
148
  ```
144
149
 
145
150
  A method file stores one capability id under nested properties. `capability.*` looks up a property named `*` and does not collect the neighboring properties.
package/README.zh-CN.md CHANGED
@@ -92,6 +92,8 @@ const profiles = require('artifact-graph/project-artifact-profiles');
92
92
 
93
93
  目标项目的 `artifact-graph.config.yaml` 拥有采用权。配置或既有方法绑定里已经声明的类型都要保留,包括清单里没有的追加类型。
94
94
 
95
+ `loadConfig`(配置加载入口)与 `artifact-graph doctor` 会检查已声明字段的结构与类型。`statuses` 应为字符串数组;写成字符串时按字段路径报错。未知顶层键会保留兼容,并给出可定位提示,不一律拒绝。已有配置文件必须写出 `allowedEdges`。写成 `[]`、`null` 或 YAML 空值时,采用内置 `DEFAULT_SCHEMA.allowedEdges`。非空清单完全替换默认表,按 from/to/kind 严格匹配;清单外关系报 `DISALLOWED_EDGE`。`forbiddenEdges` 仍优先报告 `FORBIDDEN_EDGE`。没有配置文件时保持未接入,不会伪装成有效项目。`extraFields` 仍是可选索引字段。本轮也尚未用 `contract validate` 校验 Markdown 正文合同。
96
+
95
97
  ### 自定义类型的 JSON 原文件
96
98
 
97
99
  内置类型继续使用各自的专用解析。`format: json` 只写在项目自己注册的自定义类型上,同一项还要给出 `idField`。省略 `format` 时,文件仍按 Markdown 解析,扫描路径写成 `*.json` 也不改变这一规则。类型声明 `format: json` 之后,才按 JSON 读取。
@@ -114,7 +116,7 @@ JSON 文件把 `fields` 中的点分字符串当成逐层属性名。
114
116
 
115
117
  点号只切开固定的属性名。`*`、筛选条件和 JSONPath 都不是路径语法;名为 `*` 的属性只按这个名字查找。数组里的记录留在原对象中。这一批读取编号,以及 `relationSemantics` 里已经声明的关系。标题、状态、编号拼接、前缀和改写都不在读取范围内。Markdown 字段仍按整个字符串查找,嵌套对象不会被点号拆开。诊断带原文件路径和字段名,行号记为 1。
116
118
 
117
- 项目可以把方法指向能力,把发行记录指向方法。下面的配置只示范这两个方向。
119
+ 项目可以把方法指向能力,把发行记录指向方法。下面的配置只示范这两个方向。非空 `allowedEdges` 会完全替换内置默认表,所以这两条项目关系必须写进清单;只写 `[]` 不能授权这些自定义类型。
118
120
 
119
121
  ```yaml
120
122
  types:
@@ -143,6 +145,9 @@ relationSemantics:
143
145
  label: 发行记录对应的方法
144
146
  targetTypes: [method]
145
147
  fields: [methods]
148
+ allowedEdges:
149
+ - { from: method, to: capability, kind: applies }
150
+ - { from: skill_release, to: method, kind: releases }
146
151
  ```
147
152
 
148
153
  方法文件把一个能力编号放在嵌套属性里。
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "artifact.spec@1",
4
+ "title": "Artifact Contract: SPEC Increment",
5
+ "description": "Declarative semantic-marker contract for SPEC Markdown. Mechanical check uses comment markers only; JSON body fields are not required and are not validated as hard slots.",
6
+ "version": "1.0.0",
7
+ "contractIdentity": {
8
+ "major": "artifact.spec@1",
9
+ "authority": "artifact",
10
+ "namespace": "artifact",
11
+ "revisionDigest": "sha256:adbb6fd0d923d49463ee461038076858be0f01e54396ea65b82d084d32439060",
12
+ "semanticMarkers": {
13
+ "changes": {
14
+ "jsonPointer": "/changes",
15
+ "markdownMarker": "changes",
16
+ "required": true
17
+ },
18
+ "scope": {
19
+ "jsonPointer": "/scope",
20
+ "markdownMarker": "scope",
21
+ "required": true
22
+ },
23
+ "acceptance": {
24
+ "jsonPointer": "/acceptance",
25
+ "markdownMarker": "acceptance",
26
+ "required": true
27
+ },
28
+ "acceptance_record": {
29
+ "jsonPointer": "/acceptance_record",
30
+ "markdownMarker": "acceptance-record",
31
+ "required": false
32
+ },
33
+ "archive_record": {
34
+ "jsonPointer": "/archive_record",
35
+ "markdownMarker": "archive-record",
36
+ "required": false
37
+ }
38
+ }
39
+ },
40
+ "type": "object",
41
+ "required": [],
42
+ "properties": {},
43
+ "additionalProperties": true
44
+ }