artifact-graph 0.13.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 CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.14.0
6
+
7
+ ### Added
8
+
9
+ - Custom artifact types can read one JSON object per original file with `format: json` and a root
10
+ `idField`. Configured relation fields follow fixed dotted property paths; graph diagnostics and
11
+ version locks continue to refer to the original file. Markdown remains the default format.
12
+ - Added `check-professional` to combine graph validation, version-lock audit, and coverage into a
13
+ graph-scoped conclusion without writing the scan cache. It can create a proof at an explicit
14
+ absolute path without overwriting an existing file. `read-proof` reads that proof without a scan.
15
+
16
+ ### Changed
17
+
18
+ - Version lockstep with `artifact-chain-assistant` 0.14.0.
19
+
5
20
  ## 0.13.0
6
21
 
7
22
  ### Added
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  [中文](README.zh-CN.md)
4
4
 
5
- Git-native Markdown artifact graph scanner and validator for agentic coding workflows.
5
+ Git-native artifact graph scanner and validator for agentic coding workflows.
6
+ Markdown stays the default parser. A custom type may set `format: json` and bring that original file into the same graph.
6
7
 
7
8
  `artifact-graph` helps projects keep requirements, scenarios, design notes, source files, tests,
8
9
  and version-lock metadata connected. It is designed for deterministic local use before an AI coding
@@ -10,8 +11,10 @@ agent claims implementation work is complete.
10
11
 
11
12
  <!-- release-skill:capability:external-write-boundary -->
12
13
  > **External-write boundary:** Installing `artifact-graph` does not modify a project or write to
13
- > remote systems. Read-only commands such as `--help`, `doctor`, `validate`, `query`, and `audit`
14
- > do not change project files. Commands including `init`, `version-lock refresh`, and
14
+ > remote systems. Read-only commands such as `--help`, `doctor`, `validate`, `query`, `audit`,
15
+ > `check-professional` (without `--conclusion-output`), and `read-proof` do not change project files.
16
+ > `--conclusion-output` creates one new proof file at an explicit absolute path and never overwrites
17
+ > an existing proof. Commands including `init`, `scan`, `version-lock refresh`, and
15
18
  > `hooks install-git` write locally only when explicitly invoked.
16
19
 
17
20
  <!-- release-skill:capability:safe-first-command -->
@@ -78,10 +81,80 @@ See [Code Traceability And Coverage Boundaries](INSTALL.md#code-traceability-and
78
81
  for syntax, scan configuration, classification, exemptions and project isolation. Inspect the
79
82
  index before `refresh --all`; there is no `version-lock update --all` operation.
80
83
 
84
+ ### JSON originals for custom types
85
+
86
+ 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`.
87
+
88
+ `idField` is the name of one property on the root object. The name is used whole, so a dot inside it stays part of the name. Each file must contain one JSON object and produces one node. The id is that property's string, including spaces and case, and is then checked with the type's existing `idPatterns`.
89
+
90
+ Invalid JSON, a root array or scalar, a missing id, a non-string id, or a blank string produces a diagnostic and no node. A string that fails `idPatterns` still produces the node, together with a diagnostic.
91
+
92
+ Relations stay in `relationSemantics`, using the existing `kind`, `fields`, `targetTypes`, and `label`. For JSON files, a dotted `fields` entry is a chain of own properties. `capability.capabilityRef` reads the root object's `capability`, then that object's `capabilityRef`. A missing property does not create an optional relation. If an intermediate value is not an object, or the final value is not a non-empty string or an array of non-empty strings, the diagnostic names the original file and the field. Valid array entries use the existing target resolver; a broken target remains a graph validation finding. An empty array creates no edge.
93
+
94
+ 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.
95
+
96
+ A project can point a method at a capability and a release record at a method. The configuration below shows those two directions.
97
+
98
+ ```yaml
99
+ types:
100
+ capability:
101
+ paths: ["capabilities/*.json"]
102
+ format: json
103
+ idField: capabilityId
104
+ method:
105
+ paths: ["methods/*.json"]
106
+ format: json
107
+ idField: methodId
108
+ skill_release:
109
+ paths: ["releases/*.json"]
110
+ format: json
111
+ idField: releaseId
112
+ idPatterns:
113
+ capability: "^CAP-[A-Z0-9-]+$"
114
+ method: "^METH-[A-Z0-9-]+$"
115
+ skill_release: "^REL-[A-Z0-9-]+$"
116
+ relationSemantics:
117
+ applies:
118
+ label: Method applies to capability
119
+ targetTypes: [capability]
120
+ fields: [capability.capabilityRef]
121
+ releases:
122
+ label: Release record points to method
123
+ targetTypes: [method]
124
+ fields: [methods]
125
+ ```
126
+
127
+ A method file stores one capability id under nested properties. `capability.*` looks up a property named `*` and does not collect the neighboring properties.
128
+
129
+ ```json
130
+ {
131
+ "methodId": "METH-1",
132
+ "capability": { "capabilityRef": "CAP-1" }
133
+ }
134
+ ```
135
+
136
+ A release file stores several method ids in a string array. `method:METH-1` is resolved by the existing `type:id` parser.
137
+
138
+ ```json
139
+ {
140
+ "releaseId": "REL-1",
141
+ "methods": ["METH-1", "method:METH-2"]
142
+ }
143
+ ```
144
+
145
+ `scanArtifacts`, `validate`, and `version-lock` consume the same graph. The lock still hashes the original file bytes. Finding the configured nodes and relations shows that those files entered the graph. Domain review and publication facts need their own evidence.
146
+
81
147
  ### Daily commands
82
148
 
83
149
  - Generate or inspect project artifact graph configuration with `artifact-graph init`.
84
150
  - Validate artifact links with `artifact-graph validate`.
151
+ - Emit a reusable graph professional proof with `artifact-graph check-professional --root . --format json`.
152
+ Add `--conclusion-output <absolute-path>` only when a proof file is required; the command composes
153
+ existing `validate`, `version-lock audit`, and `coverage` checks and does not write graph cache.
154
+ - Read one graph proof with `artifact-graph read-proof --proof-root <root> --proof <relative> --format json`.
155
+ `GRAPH_CLEAR` with complete scope is `pass`; findings, incomplete checks, and recorded unavailability
156
+ are `not_pass`. A missing, damaged, foreign, or unknown-code file is `unavailable`. This is not the
157
+ Review Result Protocol.
85
158
  - Validate Review Result Protocol v1.0 documents with `artifact-graph validate-review-result --file <path>`.
86
159
  - Build implementation context with `artifact-graph context` or `artifact-graph packet`.
87
160
  - Add `--view current|planned|history|all` to `query`, `context`, or `packet` when a project maps
package/README.zh-CN.md CHANGED
@@ -2,14 +2,17 @@
2
2
 
3
3
  [English](README.md)
4
4
 
5
- `artifact-graph` 是一个 Git 原生的 Markdown 制品图扫描与校验工具,面向 AI 编程工作流。
5
+ `artifact-graph` 是一个 Git 原生的制品图扫描与校验工具,面向 AI 编程工作流。
6
+ 默认解析 Markdown。自定义类型可以声明 `format: json`,把 JSON 原文件读进同一张图。
6
7
 
7
8
  它把项目里的需求、场景、设计、源码、测试和 version-lock 元数据连成一张图,
8
9
  供 AI agent 在宣称实现完成之前,用确定性的本地命令检查上下文和追溯关系。
9
10
 
10
11
  <!-- release-skill:capability:external-write-boundary -->
11
12
  > **外部写入边界:** 安装 `artifact-graph` 不会修改项目或写入远端。`--help`、`doctor`、
12
- > `validate`、`query` 和 `audit` 等只读命令不会更改项目文件。只有显式执行 `init`、
13
+ > `validate`、`query`、`audit`、不带 `--conclusion-output` 的 `check-professional` 以及
14
+ > `read-proof` 等只读命令不会更改项目文件。`--conclusion-output` 只在明确的绝对路径
15
+ > 排他创建一份证明,不会覆盖已有证明。只有显式执行 `init`、`scan`、
13
16
  > `version-lock refresh` 或 `hooks install-git` 等命令时才会发生本地写入。
14
17
 
15
18
  <!-- release-skill:capability:safe-first-command -->
@@ -75,10 +78,90 @@ Python 的 `#` 注释目前不受支持。
75
78
  见 [代码追溯接入说明](INSTALL.md#code-traceability-and-coverage-boundaries)。先确认索引中确有预期节点和关系,
76
79
  再运行 `refresh --all` 建立锁;不存在 `version-lock update --all` 操作。
77
80
 
81
+ ### 自定义类型的 JSON 原文件
82
+
83
+ 内置类型继续使用各自的专用解析。`format: json` 只写在项目自己注册的自定义类型上,同一项还要给出 `idField`。省略 `format` 时,文件仍按 Markdown 解析,扫描路径写成 `*.json` 也不改变这一规则。类型声明 `format: json` 之后,才按 JSON 读取。
84
+
85
+ `idField` 是根对象上的一个属性名。查找时使用这个完整名字,名字里的点号仍是名字的一部分。每个文件只接受一个 JSON 对象,并生成一个节点。编号取该属性中的字符串,空格和大小写按原文保留,再用该类型已有的 `idPatterns` 检查。
86
+
87
+ 下面的输入会给出诊断,并且不生成节点:
88
+
89
+ - JSON 文本无法解析;
90
+ - 根值是数组、字符串、数字、布尔值或 `null`;
91
+ - 编号属性不存在,或者值不是非空字符串。
92
+
93
+ 编号字符串存在,但不符合 `idPatterns` 时,节点仍然保留,同时报出诊断。
94
+
95
+ 关系继续写在 `relationSemantics` 里,沿用原来的 `kind`、`fields`、`targetTypes` 和 `label`。
96
+ JSON 文件把 `fields` 中的点分字符串当成逐层属性名。
97
+ 以 `capability.capabilityRef` 为例,解析先读根对象自己的 `capability`,再读下一层对象自己的 `capabilityRef`。
98
+
99
+ 某一层没有这个属性时,这条可选关系不进入图。中间值不是对象,或者末端不是非空字符串,也不是非空字符串数组时,诊断写明原文件路径和字段名。数组中的每个合法字符串交给现有目标解析。对不上现有节点的引用,仍由原来的图校验报告。空数组不生成边。
100
+
101
+ 点号只切开固定的属性名。`*`、筛选条件和 JSONPath 都不是路径语法;名为 `*` 的属性只按这个名字查找。数组里的记录留在原对象中。这一批读取编号,以及 `relationSemantics` 里已经声明的关系。标题、状态、编号拼接、前缀和改写都不在读取范围内。Markdown 字段仍按整个字符串查找,嵌套对象不会被点号拆开。诊断带原文件路径和字段名,行号记为 1。
102
+
103
+ 项目可以把方法指向能力,把发行记录指向方法。下面的配置只示范这两个方向。
104
+
105
+ ```yaml
106
+ types:
107
+ capability:
108
+ paths: ["capabilities/*.json"]
109
+ format: json
110
+ idField: capabilityId
111
+ method:
112
+ paths: ["methods/*.json"]
113
+ format: json
114
+ idField: methodId
115
+ skill_release:
116
+ paths: ["releases/*.json"]
117
+ format: json
118
+ idField: releaseId
119
+ idPatterns:
120
+ capability: "^CAP-[A-Z0-9-]+$"
121
+ method: "^METH-[A-Z0-9-]+$"
122
+ skill_release: "^REL-[A-Z0-9-]+$"
123
+ relationSemantics:
124
+ applies:
125
+ label: 方法适用的能力
126
+ targetTypes: [capability]
127
+ fields: [capability.capabilityRef]
128
+ releases:
129
+ label: 发行记录对应的方法
130
+ targetTypes: [method]
131
+ fields: [methods]
132
+ ```
133
+
134
+ 方法文件把一个能力编号放在嵌套属性里。
135
+
136
+ ```json
137
+ {
138
+ "methodId": "METH-1",
139
+ "capability": { "capabilityRef": "CAP-1" }
140
+ }
141
+ ```
142
+
143
+ 发行文件用字符串数组保存多个方法编号。`method:METH-1` 交给现有的 `type:id` 解析。
144
+
145
+ ```json
146
+ {
147
+ "releaseId": "REL-1",
148
+ "methods": ["METH-1", "method:METH-2"]
149
+ }
150
+ ```
151
+
152
+ `scanArtifacts`、`validate` 和 `version-lock` 消费同一张图,锁按原文件字节计算。读到节点和已配置关系,只说明这些原文件进入了图。领域审核和发布事实需要各自的证据。
153
+
78
154
  ### 日常命令
79
155
 
80
156
  - 用 `artifact-graph init` 生成或检查项目制品图配置。
81
157
  - 用 `artifact-graph validate` 校验制品之间的链接。
158
+ - 用 `artifact-graph check-professional --root . --format json` 生成可复用的图专业证明。
159
+ 只有需要证明文件时才加 `--conclusion-output <绝对路径>`;该命令组合已有的
160
+ `validate`、`version-lock audit` 和 `coverage`,不写图缓存。
161
+ - 用 `artifact-graph read-proof --proof-root <root> --proof <相对路径> --format json`
162
+ 阅读本族证明。`GRAPH_CLEAR` 且范围 complete 为 `pass`;发现问题、检查未完成或证明记载
163
+ 未能检查为 `not_pass`。缺文件、损坏、非本族或未知领域码为 `unavailable`。这与
164
+ Review Result Protocol 不是同一合同。
82
165
  - 用 `artifact-graph validate-review-result --file <path>` 校验 Review Result Protocol v1.0 文档。
83
166
  - 用 `artifact-graph context` 或 `artifact-graph packet` 构建实现上下文。
84
167
  - 项目通过 `statusViews` 映射状态后,可在 `query`、`context` 或 `packet` 上增加
@@ -91,7 +174,7 @@ Python 的 `#` 注释目前不受支持。
91
174
  `artifactRelations` 时视为空数组;首次启用时执行一次 `refresh --all` 建立完整关系基线。
92
175
  - 用 `artifact-graph hooks install-git --hook all` 安装可选 Git hooks。
93
176
  - 用 `artifact-graph restructure inspect` 和 `artifact-graph restructure plan` 检查与规划制品重组:
94
- 这两步只读取入并确定性地编译你给出的映射,不写项目。
177
+ 这两步只读取入并确定性地编译已经给出的映射,不写项目。
95
178
 
96
179
  ### 制品重组(拆分、跨文件移动与重编号)
97
180