artifact-graph 0.9.4 → 0.11.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 +44 -0
- package/INSTALL.md +212 -0
- package/README.md +22 -0
- package/README.zh-CN.md +22 -0
- package/dist/cli.js +3807 -2182
- package/dist/index.cjs +2994 -2155
- package/dist/index.d.cts +181 -1
- package/dist/index.d.ts +181 -1
- package/dist/index.js +2971 -2142
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.11.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added configuration-driven relation semantics and current/planned/history graph views, including
|
|
10
|
+
partial-replacement section annotations and protection against planned replacements invalidating
|
|
11
|
+
the current baseline.
|
|
12
|
+
- Added read-only `impact` and `coverage` reports. Coverage exposes graph and scan boundaries plus
|
|
13
|
+
raw behavior/release references without inferring successful verification or publication.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Clarified source annotation syntax, scan scope, missing-lock counting and release-coverage
|
|
18
|
+
limits in the installation guide and README. CLI help and Markdown version-lock audits now
|
|
19
|
+
explain that passing a strict audit, including a zero-lock result, does not prove full
|
|
20
|
+
implementation coverage. Lock semantics, JSON output and exit-code policies are unchanged.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Version lockstep with `artifact-chain-assistant` 0.11.0.
|
|
25
|
+
|
|
26
|
+
## 0.10.0
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- Added transactional `refactor-id` support for renaming artifact identifiers across configured
|
|
31
|
+
artifacts, source annotations, and tests. The command reports version-lock impact without
|
|
32
|
+
changing the lock, preserves unrelated bytes and file modes, detects conflicts before writing,
|
|
33
|
+
and rolls back the whole transaction if a write fails.
|
|
34
|
+
- Added structured native-binding diagnostics for the CLI and Node library, including the selected
|
|
35
|
+
installation, probe source, failure stage, stable cause, and actionable remediation.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- `doctor`, `scan`, and `query` now classify `better-sqlite3` failures against the installation
|
|
40
|
+
that actually provides the running CLI. A target project's dependencies can no longer change
|
|
41
|
+
`MISSING`, `BUILD_DISABLED`, ABI mismatch, or load-error classification.
|
|
42
|
+
- CommonJS `require`, ESM import, and packed CLI use are covered by the release consumer matrix and
|
|
43
|
+
remain loadable when lifecycle scripts are disabled. SQLite-dependent `doctor`, `scan`, and
|
|
44
|
+
`query` operations then fail with the documented structured diagnostic instead of an unrelated
|
|
45
|
+
loader error.
|
|
46
|
+
|
|
3
47
|
## 0.9.4
|
|
4
48
|
|
|
5
49
|
### Changed
|
package/INSTALL.md
CHANGED
|
@@ -90,6 +90,218 @@ npx artifact-graph version-lock audit --root . --strict-missing-lock
|
|
|
90
90
|
> Use `version-lock refresh --all` for the initial lock. The `--changed-only --staged` variant is for
|
|
91
91
|
> pre-commit hooks on existing projects — not for first-time initialization.
|
|
92
92
|
|
|
93
|
+
## Code Traceability And Coverage Boundaries
|
|
94
|
+
|
|
95
|
+
Version locks track declared relationships and changes to their file contents. A successful
|
|
96
|
+
`version-lock audit --strict-missing-lock` does **not** prove that every release file has an
|
|
97
|
+
artifact link or that every artifact has an implementation. Read this section before using
|
|
98
|
+
the audit as a release acceptance check.
|
|
99
|
+
|
|
100
|
+
### Declare a source-to-artifact link
|
|
101
|
+
|
|
102
|
+
Use a standalone line comment in source files whose language accepts `//`:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
// @feature A1
|
|
106
|
+
// @scenario S-01 @feature A1
|
|
107
|
+
// @decision D-TOOL-01
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The syntax is `@<registered-type-or-alias> <artifact-ID>`. The tag selects the type; the value
|
|
111
|
+
is the ID, not `feature:A1`, a Markdown link, or a file path. Separate multiple IDs with spaces
|
|
112
|
+
or commas, or repeat the tag. Each ID must match the configured type's `idPatterns`. Custom
|
|
113
|
+
types and their explicit aliases are supported when registered in the project configuration.
|
|
114
|
+
Keep explanatory prose on a separate line. Split mappings that combine multiple scenarios
|
|
115
|
+
and multiple features into separate lines so their correspondence is unambiguous.
|
|
116
|
+
|
|
117
|
+
For a Markdown implementation such as a skill, use a standalone, single-line HTML comment:
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
<!-- @feature A1 -->
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Place the comment outside fenced examples so it declares the file's own responsibility.
|
|
124
|
+
The scanner is a text parser, not a language compiler. It recognizes standalone `//` and
|
|
125
|
+
single-line `<!-- ... -->` forms. It does not support native Python/shell `#` comments, SQL
|
|
126
|
+
`--` comments, or `/* ... */`/JSDoc traceability blocks. Trailing `//` comments after code are
|
|
127
|
+
invalid. Do not put invalid-language `//` comments into Python files to work around this limit.
|
|
128
|
+
JavaScript, TypeScript and Java are examples of languages that can use the `//` form;
|
|
129
|
+
this is not a promise of complete language-specific syntax parsing.
|
|
130
|
+
|
|
131
|
+
### Configure the files to scan
|
|
132
|
+
|
|
133
|
+
Source annotations are parsed through `types.test.paths`, including implementation files.
|
|
134
|
+
The historical name `test` does not mean that every matching file becomes a test node.
|
|
135
|
+
Merge paths appropriate to the project into its existing `artifact-graph.config.yaml`:
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
types:
|
|
139
|
+
test:
|
|
140
|
+
paths:
|
|
141
|
+
- "src/**/*.ts"
|
|
142
|
+
- "src/**/*.tsx"
|
|
143
|
+
- "tests/**/*.ts"
|
|
144
|
+
- "skills/**/*.md"
|
|
145
|
+
idPatterns:
|
|
146
|
+
test: '^.+\.(ts|tsx|md)$'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
These are example source paths, not a replacement for the project's artifact type definitions.
|
|
150
|
+
The built-in default only matches `heimdall/packages/**/*.test.ts`; ordinary `src/` and
|
|
151
|
+
`skills/` trees require configuration. Directory walking skips `node_modules`, `dist`, `.git`
|
|
152
|
+
and `.artifact-graph`. Scanning does not derive scope from a release manifest or `.gitignore`.
|
|
153
|
+
If types overlap, the most specific path definition claims the file; check the
|
|
154
|
+
`ARTIFACT_PATH_OVERLAP` diagnostic rather than assuming both parsers run.
|
|
155
|
+
|
|
156
|
+
Files named `*.test.*`, `*.spec.*`, `*Test.java` or `*Tests.java`, and files under `test/`,
|
|
157
|
+
`tests/` or `__tests__/`, are classified as tests and create `verifies` locks. Other annotated
|
|
158
|
+
files create implementation nodes and `implements` locks. A plain file with no recognized
|
|
159
|
+
annotation produces no source node. A skill Markdown file claimed by a custom artifact type
|
|
160
|
+
is an artifact node, not automatically a code implementation; confirm `sourceKind` in the
|
|
161
|
+
version index before choosing an implementation-lock policy.
|
|
162
|
+
|
|
163
|
+
### Establish and check the locks
|
|
164
|
+
|
|
165
|
+
After declaring real links and verifying their targets, run:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pnpm exec artifact-graph version-index --root . --format json
|
|
169
|
+
pnpm exec artifact-graph validate --root . --format json
|
|
170
|
+
pnpm exec artifact-graph version-lock refresh --root . --all --format markdown
|
|
171
|
+
pnpm exec artifact-graph version-lock audit --root . --strict-missing-lock --format json
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Inspect the index for the intended source nodes and edges. `validate` checks annotation/link
|
|
175
|
+
errors; `refresh --all` records current hashes for discovered relationships; `audit` checks
|
|
176
|
+
those locks. These commands do not execute the source or prove that an implementation meets
|
|
177
|
+
its requirements. Use a separate, existing project test gate for behavioral verification.
|
|
178
|
+
Do not automatically refresh immediately before the acceptance audit merely to clear stale
|
|
179
|
+
hashes: first review the changes and run the relevant tests.
|
|
180
|
+
|
|
181
|
+
To lock just one declared relationship, use:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pnpm exec artifact-graph version-lock update --root . --target feature:A1 --source skills/example/SKILL.md
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`update` requires both `--target` and `--source`; there is no `update --all` operation.
|
|
188
|
+
`bootstrap` can establish an initial baseline, but `refresh --all` is the recommended
|
|
189
|
+
incremental entry. Do not use `bootstrap --force` in routine maintenance or hooks.
|
|
190
|
+
|
|
191
|
+
### What missing_lock counts
|
|
192
|
+
|
|
193
|
+
`missing_lock` is reported per discovered, lockable relationship without a corresponding lock:
|
|
194
|
+
|
|
195
|
+
- Source-to-artifact `implements`/`verifies` relationships are checked against `locks`.
|
|
196
|
+
- Artifact-to-artifact relationships are checked against `artifactRelations` too.
|
|
197
|
+
- With runners configured, tests in discovery scope but inactive in every matching runner
|
|
198
|
+
are excluded from automatic lock creation and missing-lock counting. Unscoped tests remain
|
|
199
|
+
lockable. Without runner configuration, the legacy fallback treats non-E2E test paths as
|
|
200
|
+
active; E2E paths need a recognized `// @e2e_test` or `// @tc` annotation to be active.
|
|
201
|
+
These liveness rules are not a general release-file exemption mechanism.
|
|
202
|
+
|
|
203
|
+
Missing locks are warnings by default; `--strict-missing-lock` makes them blocking without
|
|
204
|
+
changing the population being checked. Do not combine a required acceptance check with
|
|
205
|
+
`--warning-only`, which suppresses its nonzero exit status.
|
|
206
|
+
|
|
207
|
+
An artifact with no relationships does not produce `missing_lock` just because it has no
|
|
208
|
+
implementation. An artifact without incoming implementation links can still have outgoing
|
|
209
|
+
artifact relationships that require relation locks. `totalLocks: 0` only counts implementation
|
|
210
|
+
and verification locks; inspect `totalArtifactRelationLocks` separately. With no lockable
|
|
211
|
+
relationships and no existing locks, even the strict audit can pass with zero locks.
|
|
212
|
+
|
|
213
|
+
### Release coverage and exemptions
|
|
214
|
+
|
|
215
|
+
The `coverage` command reports graph health, scan mapping, declared behavior references, and an
|
|
216
|
+
optional caller-supplied release-file mapping. It is a boundary report, not a release-payload gate:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
pnpm exec artifact-graph coverage --root . --format json
|
|
220
|
+
pnpm exec artifact-graph coverage --root . --release-input release-files.txt --format json
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Behavior verification is reported as `not-evaluated`; implementation, verification, and evidence
|
|
224
|
+
edges remain raw declaration references. With a release input list, mapped and unmapped paths are
|
|
225
|
+
reported but release status remains `unknown` and evidence remains empty. Without a list, release
|
|
226
|
+
status is `not-requested`. The command never turns a file list into proof that a version was
|
|
227
|
+
published. Graph health accounts for validation and lock issues. Scan coverage reports both files
|
|
228
|
+
inside configured scan paths and files actually mapped to nodes or edge sources; changed-path
|
|
229
|
+
classification is marked unavailable outside a Git worktree. There is no general artifact/file exemption marker for `missing_lock`; E2E coverage
|
|
230
|
+
waivers concern a different check and must not be used as implementation-lock exemptions.
|
|
231
|
+
|
|
232
|
+
For a policy requiring every release code file to link upward and every required artifact to
|
|
233
|
+
have an implementation or approved exemption, keep two separate checks:
|
|
234
|
+
|
|
235
|
+
1. Use the existing release process's authoritative payload list to compare expected source
|
|
236
|
+
files with the version index and implementation locks. Compare the required artifact set
|
|
237
|
+
with incoming implementation locks and the project's explicitly approved exceptions.
|
|
238
|
+
2. Use `validate` and strict version-lock audit for declared links and their freshness, plus
|
|
239
|
+
the project's behavioral tests. These checks cannot replace the coverage comparison.
|
|
240
|
+
|
|
241
|
+
The acceptance decision remains a project/release-policy responsibility. `coverage` can compare
|
|
242
|
+
the caller's existing inventory with graph mapping, but does not own that inventory or approve its
|
|
243
|
+
exceptions. Reuse existing release inventory and approval records; do not maintain a second
|
|
244
|
+
payload manifest or invent an artifact-graph exemption field. If no authoritative execution or
|
|
245
|
+
release result exists, keep the corresponding fact unknown rather than accepting the mapping or
|
|
246
|
+
lock audit as proof.
|
|
247
|
+
|
|
248
|
+
### Time views and read-only impact
|
|
249
|
+
|
|
250
|
+
Projects may map their own status words into `current`, `planned`, and `history` with
|
|
251
|
+
`statusViews`. Explicit views are available on graph queries and context assembly; omitting
|
|
252
|
+
`--view` preserves the earlier unfiltered behavior:
|
|
253
|
+
|
|
254
|
+
```yaml
|
|
255
|
+
statusViews:
|
|
256
|
+
active: current
|
|
257
|
+
accepted: current
|
|
258
|
+
planned: planned
|
|
259
|
+
open: planned
|
|
260
|
+
done: history
|
|
261
|
+
deprecated: history
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
pnpm exec artifact-graph query --from feature:A1 --view current --format json
|
|
266
|
+
pnpm exec artifact-graph context --target feature:A1 --view current --format json
|
|
267
|
+
pnpm exec artifact-graph packet --target feature:A1 --view current --format json
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
When a project configures `supersedes`, a full replacement moves its target to history only while
|
|
271
|
+
the replacing artifact maps to `current`. A planned or uncategorized replacement cannot invalidate
|
|
272
|
+
the current baseline. A partial replacement keeps the old artifact in its own view and reports the
|
|
273
|
+
replaced sections when the replacing artifact is current.
|
|
274
|
+
|
|
275
|
+
Use `impact` when selecting work or tests without refreshing locks:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
pnpm exec artifact-graph impact --root . --worktree --format json
|
|
279
|
+
pnpm exec artifact-graph impact --root . --staged --format json
|
|
280
|
+
pnpm exec artifact-graph impact --root . --base main --format json
|
|
281
|
+
pnpm exec artifact-graph impact --root . --paths src/a.ts,src/b.ts --format json
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
The report separates directly mapped nodes, related nodes and edges, graph-control files, files in
|
|
285
|
+
configured scan scope that did not resolve to a node, and paths outside scan scope. Generating the
|
|
286
|
+
report does not refresh locks or write graph state.
|
|
287
|
+
|
|
288
|
+
Exclude tooling such as non-shipped `scripts/check-*.py` from the release coverage denominator
|
|
289
|
+
using the release inventory. Omitting those files from annotation scan paths is a scan-scope
|
|
290
|
+
decision, not a machine-validated exemption. Shipped compatibility forwarding shells still
|
|
291
|
+
belong in the payload comparison: link them to the artifact describing compatibility behavior,
|
|
292
|
+
or record an exception in the project's existing approval process. An ADR that is intentionally
|
|
293
|
+
documentation-only need not be assigned a fabricated implementation link.
|
|
294
|
+
|
|
295
|
+
### Store locks per project
|
|
296
|
+
|
|
297
|
+
Commit `artifacts/traceability-version-lock.json` with the project and review its diff; do not
|
|
298
|
+
gitignore it. The lock stores project-relative paths and content hashes so another checkout
|
|
299
|
+
can audit the same baseline. Generated caches such as `.artifact-graph/` are separate.
|
|
300
|
+
Use each project's own `--root` and lock file even when projects share one CLI installation.
|
|
301
|
+
If a project uses `--lock-path`, pass the same project-relative path to every lock command and
|
|
302
|
+
its hooks/CI; the flag is an invocation option, not a persistent setting. Keep one authoritative
|
|
303
|
+
lock per effective project graph, rather than sharing a lock across unrelated roots.
|
|
304
|
+
|
|
93
305
|
## Cleaning Up Orphan Locks
|
|
94
306
|
|
|
95
307
|
After deleting or splitting an artifact (or removing a traceability edge), the affected version
|
package/README.md
CHANGED
|
@@ -63,10 +63,32 @@ npx artifact-graph version-lock audit --root . --strict-missing-lock
|
|
|
63
63
|
|
|
64
64
|
## Common Workflows
|
|
65
65
|
|
|
66
|
+
### Code traceability starts with scan scope
|
|
67
|
+
|
|
68
|
+
Declare links with standalone `// @feature A1` source comments or `<!-- @feature A1 -->`
|
|
69
|
+
in skill Markdown. Include those files in `types.test.paths`, which also handles implementation
|
|
70
|
+
sources; the default does not scan every `src/` or `skills/` tree. Native Python `#` comments
|
|
71
|
+
are not supported.
|
|
72
|
+
|
|
73
|
+
> `version-lock audit --strict-missing-lock` checks locks for discovered relationships. Files
|
|
74
|
+
> without annotations and artifacts without relationships can remain invisible to missing-lock
|
|
75
|
+
> checks; even zero locks can pass. It does not prove complete release-file or artifact coverage.
|
|
76
|
+
|
|
77
|
+
See [Code Traceability And Coverage Boundaries](INSTALL.md#code-traceability-and-coverage-boundaries)
|
|
78
|
+
for syntax, scan configuration, classification, exemptions and project isolation. Inspect the
|
|
79
|
+
index before `refresh --all`; there is no `version-lock update --all` operation.
|
|
80
|
+
|
|
81
|
+
### Daily commands
|
|
82
|
+
|
|
66
83
|
- Generate or inspect project artifact graph configuration with `artifact-graph init`.
|
|
67
84
|
- Validate artifact links with `artifact-graph validate`.
|
|
68
85
|
- Validate Review Result Protocol v1.0 documents with `artifact-graph validate-review-result --file <path>`.
|
|
69
86
|
- Build implementation context with `artifact-graph context` or `artifact-graph packet`.
|
|
87
|
+
- Add `--view current|planned|history|all` to `query`, `context`, or `packet` when a project maps
|
|
88
|
+
statuses through `statusViews`. The default stays compatible with the unfiltered graph.
|
|
89
|
+
- Inspect change impact without refreshing locks with `artifact-graph impact --worktree`.
|
|
90
|
+
- Report graph health, scan mapping, and the limits of behavior/release evidence with
|
|
91
|
+
`artifact-graph coverage`. The command does not infer successful verification or publication.
|
|
70
92
|
- Keep traceability freshness with `artifact-graph version-lock refresh` and `audit`.
|
|
71
93
|
- Version lock covers both implementation/verification edges (`locks`) and artifact-to-artifact
|
|
72
94
|
relations (`artifactRelations`). Old 1.0 lock files without `artifactRelations` are treated as
|
package/README.zh-CN.md
CHANGED
|
@@ -60,10 +60,32 @@ npx artifact-graph version-lock audit --root . --strict-missing-lock
|
|
|
60
60
|
|
|
61
61
|
## 常见工作流
|
|
62
62
|
|
|
63
|
+
### 代码与制品追溯:先确认扫描范围
|
|
64
|
+
|
|
65
|
+
源码可用独占一行的 `// @feature A1` 声明实现关系;技能 Markdown 可用
|
|
66
|
+
`<!-- @feature A1 -->`。`A1` 是制品 ID,命令行的 `feature:A1` 写法不能直接放在注释值中。
|
|
67
|
+
文件必须纳入 `types.test.paths`;该字段也用于实现文件,默认不会扫描所有 `src/` 或 `skills/`。
|
|
68
|
+
Python 的 `#` 注释目前不受支持。
|
|
69
|
+
|
|
70
|
+
> `version-lock audit --strict-missing-lock` 只检查已发现关系的锁与新鲜度。
|
|
71
|
+
> 没有注释的文件、没有关系的制品可能不产生缺锁问题;零锁也可能审计通过。
|
|
72
|
+
> 它不能证明“每个发布文件都有制品来源、每个制品都有实现或豁免”。
|
|
73
|
+
|
|
74
|
+
详细语法、扫描配置、`implements`(实现)与 `verifies`(验证)的分类、豁免边界及多项目隔离,
|
|
75
|
+
见 [代码追溯接入说明](INSTALL.md#code-traceability-and-coverage-boundaries)。先确认索引中确有预期节点和关系,
|
|
76
|
+
再运行 `refresh --all` 建立锁;不存在 `version-lock update --all` 操作。
|
|
77
|
+
|
|
78
|
+
### 日常命令
|
|
79
|
+
|
|
63
80
|
- 用 `artifact-graph init` 生成或检查项目制品图配置。
|
|
64
81
|
- 用 `artifact-graph validate` 校验制品之间的链接。
|
|
65
82
|
- 用 `artifact-graph validate-review-result --file <path>` 校验 Review Result Protocol v1.0 文档。
|
|
66
83
|
- 用 `artifact-graph context` 或 `artifact-graph packet` 构建实现上下文。
|
|
84
|
+
- 项目通过 `statusViews` 映射状态后,可在 `query`、`context` 或 `packet` 上增加
|
|
85
|
+
`--view current|planned|history|all`;不传参数时仍返回兼容旧版的未过滤图。
|
|
86
|
+
- 用 `artifact-graph impact --worktree` 只读查看变更影响,不刷新版本锁。
|
|
87
|
+
- 用 `artifact-graph coverage` 报告图健康、扫描映射以及行为与发布证据的评估边界;
|
|
88
|
+
该命令不推断验证成功或已经发布。
|
|
67
89
|
- 用 `artifact-graph version-lock refresh` 和 `audit` 保持追溯关系及时更新。
|
|
68
90
|
- 版本锁覆盖实现/验证边(`locks`)和制品间关系(`artifactRelations`)。旧版 1.0 锁文件缺少
|
|
69
91
|
`artifactRelations` 时视为空数组;首次启用时执行一次 `refresh --all` 建立完整关系基线。
|