artifact-graph 0.4.1 → 0.6.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 +85 -0
- package/INSTALL.md +110 -16
- package/README.md +22 -6
- package/README.zh-CN.md +21 -6
- package/dist/cli.js +1158 -118
- package/dist/index.cjs +988 -101
- package/dist/index.d.cts +162 -6
- package/dist/index.d.ts +162 -6
- package/dist/index.js +983 -98
- package/package.json +2 -1
- package/schemas/review-result.schema.json +74 -1
- package/templates/git-hooks/pre-commit.sh +18 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,91 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.6.0
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **E2E coverage proof mechanism**: `validate --include e2e-coverage` now outputs executable_ref
|
|
10
|
+
coverage statistics (total TCs, with executable_ref, rate), status breakdown, chain_type breakdown,
|
|
11
|
+
uncovered scenarios, and uncovered features. JSON and human-readable formats supported.
|
|
12
|
+
- Configurable thresholds via `artifact-graph.config.yaml` `e2e` section:
|
|
13
|
+
`executable_ref_warning`, `executable_ref_error`, `report_uncovered_scenarios`,
|
|
14
|
+
`report_uncovered_features`, `scenario_waivers`, `feature_waivers`.
|
|
15
|
+
- Threshold violations produce `E2E_COVERAGE_WARNING` / `E2E_COVERAGE_ERROR` findings.
|
|
16
|
+
|
|
17
|
+
- **TC status lifecycle validation**: TCs with invalid `status` values produce `E2E_INVALID_TC_STATUS`.
|
|
18
|
+
`waived` status requires non-empty `waived_reason` (`E2E_WAIVED_NO_REASON`).
|
|
19
|
+
|
|
20
|
+
- **chain_type vocabulary validation**: Invalid chain_type produces `E2E_INVALID_CHAIN_TYPE`.
|
|
21
|
+
Deprecated aliases `core_only` → `core_e2e`, `frontend_only` → `mock_playwright` produce
|
|
22
|
+
`E2E_DEPRECATED_CHAIN_TYPE` migration warnings.
|
|
23
|
+
|
|
24
|
+
- **ac_coverage_rate freetext detection**: Handwritten percentages produce
|
|
25
|
+
`E2E_AC_COVERAGE_RATE_FREETEXT` — this field must be computed, not manually entered.
|
|
26
|
+
|
|
27
|
+
- **Deterministic checklist rules**:
|
|
28
|
+
- `E2E-UNIT-TEST-NOT-E2E`: executable_ref pointing to `.test.ts` instead of `.spec.ts`.
|
|
29
|
+
- Version-lock liveness: E2E spec files with no active `@e2e_test`/`@tc` annotations produce
|
|
30
|
+
`orphan_lock` liveness warnings.
|
|
31
|
+
|
|
32
|
+
- **`generate-e2e-registry` command**: Deterministic, idempotent E2E registry generation from
|
|
33
|
+
Markdown test files. `--deterministic` flag sets `generated_at` to epoch for diff checks.
|
|
34
|
+
`--out <path>` writes output to file.
|
|
35
|
+
|
|
36
|
+
- **E2E-TRACE-004 Markdown authority**: When a TC explicitly declares `chain_type: desktop_chain`,
|
|
37
|
+
conflicts with source-level `mock_playwright` annotations are downgraded to info (per
|
|
38
|
+
artifact-chain-spec §5.2: Markdown side is authoritative).
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **`validate --format json`** output is now wrapped in `{ issues, e2eCoverage }` when
|
|
43
|
+
`--include e2e-coverage` is specified. Without `--include e2e-coverage`, output remains a raw
|
|
44
|
+
issues array (backward compatible).
|
|
45
|
+
|
|
46
|
+
## 0.5.0
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- **Universal baseline policy**: `resolveArtifactContext` now injects 19 always-present baseline
|
|
51
|
+
files (AGENTS.md, CLAUDE.md, artifact-chain-spec, blueprints, contracts, etc.) as required context
|
|
52
|
+
by default. `scanArtifacts` stores a normalized absolute `root` on the graph so that
|
|
53
|
+
`resolveArtifactContext` can fall back to `graph.root` when callers omit `opts.root`.
|
|
54
|
+
- Default: `context.universal_baseline` is `true` (all baseline files injected and verified).
|
|
55
|
+
- Explicit opt-out: set `context.universal_baseline: false` in `artifact-graph.config.yaml` to
|
|
56
|
+
skip baseline injection entirely for lightweight or partial projects.
|
|
57
|
+
- Config validation: `loadConfig` rejects non-boolean values (`0`, `""`, `"false"`, `1`, `"true"`)
|
|
58
|
+
with an explicit error.
|
|
59
|
+
- Fail-closed: when baseline is enabled but no project root is available, all 19 baseline items
|
|
60
|
+
appear in `missingDetails` with kind `missing-baseline`; the manifest writes
|
|
61
|
+
`baselinePolicy: true` so downstream packet validation cannot silently infer opt-out.
|
|
62
|
+
- Readability gate: baseline file checks now verify both `stat.isFile()` and read permission
|
|
63
|
+
(`access(R_OK)`), so unreadable files are reported in `missingDetails` rather than silently
|
|
64
|
+
skipped.
|
|
65
|
+
- **`ArtifactGraph.root` field**: `ArtifactGraph` interface gains an optional `root?: string` field
|
|
66
|
+
populated by `scanArtifacts` with the normalized absolute project root. Consumers that construct
|
|
67
|
+
graph literals without this field remain backward-compatible.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- **CLI `--help`/`-h` safety for subcommands**: `artifact-graph hooks install-git --help/-h` and
|
|
72
|
+
`artifact-graph version-lock --help/-h` now exit 0 and print usage without executing command
|
|
73
|
+
side effects. Previously, `hooks install-git --help` would install hooks into the Git repository
|
|
74
|
+
instead of showing help. This prevents accidental hook installation when users pass `--help` to
|
|
75
|
+
verify CLI behavior. Regression tests verify that `--help`, `-h`, and positional `help` tokens
|
|
76
|
+
do not create or modify Git hooks.
|
|
77
|
+
- **Review Result input hardening**: reject unknown top-level fields and attempts outside 1–3;
|
|
78
|
+
require producer identity for successful PASS decisions; reject PASS decisions with open block
|
|
79
|
+
findings; and reject repair self-acceptance using stable `executor + name` identity even when
|
|
80
|
+
`skill` metadata differs. This tightens Review Result v1.0 consumption compatibility, including
|
|
81
|
+
acceptance identity rules: migrate legacy top-level fields into protocol sections and run
|
|
82
|
+
`artifact-graph validate-review-result --file <result.json> --format json` before consumption.
|
|
83
|
+
- **Canonical E2E code tag**: add `@e2e_test` as the canonical traceability tag; legacy `@tc`
|
|
84
|
+
remains an alias and emits the `E2E-TRACE-007` deprecation warning from generic code-comment scans.
|
|
85
|
+
- **Traceability annotation false-positive fix**: reduce false positives in source/test traceability
|
|
86
|
+
comment validation for custom artifact types registered via `artifact-graph.config.yaml`.
|
|
87
|
+
- **Pre-commit hook configuration detection**: improve pre-commit hook configuration detection to
|
|
88
|
+
handle non-standard Git hook directory layouts and `core.hooksPath` overrides.
|
|
89
|
+
|
|
5
90
|
## 0.4.1
|
|
6
91
|
|
|
7
92
|
### Changed
|
package/INSTALL.md
CHANGED
|
@@ -21,7 +21,7 @@ npm install --save-dev artifact-graph
|
|
|
21
21
|
### From GitHub
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
npm install github:mzdbxqh/artifact-graph
|
|
24
|
+
npm install --save-dev github:mzdbxqh/artifact-graph
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Or with pnpm:
|
|
@@ -33,47 +33,141 @@ pnpm add -D github:mzdbxqh/artifact-graph
|
|
|
33
33
|
After installation, verify the CLI is available:
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
|
|
36
|
+
# pnpm
|
|
37
|
+
pnpm exec artifact-graph --help
|
|
38
|
+
|
|
39
|
+
# npm
|
|
40
|
+
npx artifact-graph --help
|
|
37
41
|
```
|
|
38
42
|
|
|
39
43
|
### pnpm Native Build Allowlist
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
`artifact-graph` depends on `better-sqlite3`, which requires a native build. pnpm blocks postinstall
|
|
46
|
+
scripts by default; you must explicitly allow the build. The configuration key depends on your pnpm
|
|
47
|
+
version:
|
|
48
|
+
|
|
49
|
+
**pnpm 10.26+** — add `allowBuilds` to `pnpm-workspace.yaml` in your project root:
|
|
43
50
|
|
|
44
51
|
```yaml
|
|
52
|
+
# pnpm-workspace.yaml (pnpm 10.26+)
|
|
45
53
|
allowBuilds:
|
|
46
54
|
better-sqlite3: true
|
|
47
55
|
```
|
|
48
56
|
|
|
49
|
-
|
|
50
|
-
|
|
57
|
+
**pnpm 10.0–10.25** — add `onlyBuiltDependencies` to your project `package.json`:
|
|
58
|
+
|
|
59
|
+
```jsonc
|
|
60
|
+
// package.json (pnpm 10.0–10.25)
|
|
61
|
+
{
|
|
62
|
+
"pnpm": {
|
|
63
|
+
"onlyBuiltDependencies": ["better-sqlite3"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Without the correct entry for your pnpm version, `pnpm install` may skip the native build and
|
|
69
|
+
`artifact-graph` will fail at runtime with a missing binding error.
|
|
51
70
|
|
|
52
71
|
## Quick Start
|
|
53
72
|
|
|
54
|
-
|
|
73
|
+
After installing as a dev dependency, use your package manager's exec to invoke the CLI. From your
|
|
74
|
+
project root:
|
|
55
75
|
|
|
56
76
|
```bash
|
|
57
|
-
|
|
58
|
-
artifact-graph
|
|
59
|
-
artifact-graph
|
|
60
|
-
artifact-graph version-lock
|
|
77
|
+
# pnpm
|
|
78
|
+
pnpm exec artifact-graph init --root .
|
|
79
|
+
pnpm exec artifact-graph validate --root . --warning-only
|
|
80
|
+
pnpm exec artifact-graph version-lock refresh --all --format markdown
|
|
81
|
+
pnpm exec artifact-graph version-lock audit --root . --strict-missing-lock
|
|
82
|
+
|
|
83
|
+
# npm
|
|
84
|
+
npx artifact-graph init --root .
|
|
85
|
+
npx artifact-graph validate --root . --warning-only
|
|
86
|
+
npx artifact-graph version-lock refresh --all --format markdown
|
|
87
|
+
npx artifact-graph version-lock audit --root . --strict-missing-lock
|
|
61
88
|
```
|
|
62
89
|
|
|
90
|
+
> Use `version-lock refresh --all` for the initial lock. The `--changed-only --staged` variant is for
|
|
91
|
+
> pre-commit hooks on existing projects — not for first-time initialization.
|
|
92
|
+
|
|
63
93
|
## Smoke Test
|
|
64
94
|
|
|
65
95
|
Run these commands to confirm the installation is working:
|
|
66
96
|
|
|
67
97
|
```bash
|
|
68
|
-
|
|
69
|
-
artifact-graph
|
|
70
|
-
artifact-graph
|
|
98
|
+
# pnpm
|
|
99
|
+
pnpm exec artifact-graph --help
|
|
100
|
+
pnpm exec artifact-graph doctor --format markdown
|
|
101
|
+
pnpm exec artifact-graph validate --root . --warning-only
|
|
102
|
+
|
|
103
|
+
# npm
|
|
104
|
+
npx artifact-graph --help
|
|
105
|
+
npx artifact-graph doctor --format markdown
|
|
106
|
+
npx artifact-graph validate --root . --warning-only
|
|
71
107
|
```
|
|
72
108
|
|
|
73
109
|
If `artifact-graph doctor` cannot find the CLI or config, check that:
|
|
74
110
|
|
|
75
|
-
1. `artifact-graph` is in `
|
|
76
|
-
|
|
111
|
+
1. `artifact-graph` is in `./node_modules/.bin/` (run `pnpm exec artifact-graph --help` or
|
|
112
|
+
`npx artifact-graph --help` to verify).
|
|
113
|
+
2. Your project has an `artifact-graph.config.yaml` (run `pnpm exec artifact-graph init --root .` or
|
|
114
|
+
`npx artifact-graph init --root .` to create one).
|
|
115
|
+
|
|
116
|
+
## Universal Baseline Policy
|
|
117
|
+
|
|
118
|
+
Starting with 0.5.0, `artifact-graph context` and `artifact-graph packet` inject 19 always-present
|
|
119
|
+
baseline files (AGENTS.md, CLAUDE.md, artifact-chain-spec, blueprints, contracts, domain artifacts,
|
|
120
|
+
verification files, etc.) as required context by default. When any of these files is missing or
|
|
121
|
+
unreadable, the context manifest reports them in `missingDetails` and the command exits non-zero.
|
|
122
|
+
|
|
123
|
+
### Default behavior
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
# artifact-graph.config.yaml
|
|
127
|
+
# context.universal_baseline defaults to true — no explicit entry needed
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
With the default, all baseline files are verified against the project root. If a file is missing,
|
|
131
|
+
is a directory, or is unreadable, it appears in the structured `missingDetails` with kind
|
|
132
|
+
`missing-baseline`.
|
|
133
|
+
|
|
134
|
+
### Explicit opt-out for lightweight projects
|
|
135
|
+
|
|
136
|
+
If your project does not contain all 19 baseline files (e.g., a partial migration or a standalone
|
|
137
|
+
library), explicitly disable baseline injection:
|
|
138
|
+
|
|
139
|
+
```yaml
|
|
140
|
+
# artifact-graph.config.yaml
|
|
141
|
+
context:
|
|
142
|
+
universal_baseline: false
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
With `false`, `resolveArtifactContext` skips baseline injection entirely. No `baseline` category
|
|
146
|
+
appears in the context manifest, and the manifest writes `baselinePolicy: false` so that
|
|
147
|
+
packet validation (`validatePacket`) correctly allows `requiredBaseline.total=0`.
|
|
148
|
+
|
|
149
|
+
### Config validation
|
|
150
|
+
|
|
151
|
+
`loadConfig` rejects non-boolean values for `context.universal_baseline`:
|
|
152
|
+
|
|
153
|
+
| Value | Result |
|
|
154
|
+
|-------|--------|
|
|
155
|
+
| `true` | Baseline enabled |
|
|
156
|
+
| `false` | Baseline disabled |
|
|
157
|
+
| `undefined` | Defaults to `true` |
|
|
158
|
+
| `0`, `1` | **Error**: `Invalid context.universal_baseline` |
|
|
159
|
+
| `""`, `"false"`, `"true"` | **Error**: `Invalid context.universal_baseline` |
|
|
160
|
+
|
|
161
|
+
### Migration impact
|
|
162
|
+
|
|
163
|
+
- **Existing projects with all baseline files present**: no change in behavior. The default
|
|
164
|
+
`true` policy was already implicit in 0.4.x context resolution.
|
|
165
|
+
- **Projects missing baseline files**: add `context.universal_baseline: false` to suppress
|
|
166
|
+
baseline verification, or create the missing files. Without this, `context` and `packet`
|
|
167
|
+
commands will exit non-zero with structured missing evidence.
|
|
168
|
+
- **Packet validation**: `validatePacket` (PKT-004) now requires an explicit `baselinePolicy`
|
|
169
|
+
field to allow `requiredBaseline.total=0`. Packets without `baselinePolicy` and with
|
|
170
|
+
`total=0, missing=[]` are rejected — this prevents silent opt-out inference.
|
|
77
171
|
|
|
78
172
|
## Related Project
|
|
79
173
|
|
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ pnpm add -D artifact-graph
|
|
|
17
17
|
Or install from GitHub:
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install github:mzdbxqh/artifact-graph
|
|
20
|
+
npm install --save-dev github:mzdbxqh/artifact-graph
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Node.js `>=22.0.0` is required. For pnpm 10+, see [INSTALL.md](INSTALL.md) for the native build
|
|
@@ -26,12 +26,22 @@ allowlist setup.
|
|
|
26
26
|
## Quick Start
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
|
|
30
|
-
artifact-graph
|
|
31
|
-
artifact-graph
|
|
32
|
-
artifact-graph version-lock
|
|
29
|
+
# pnpm
|
|
30
|
+
pnpm exec artifact-graph init --root .
|
|
31
|
+
pnpm exec artifact-graph validate --root . --warning-only
|
|
32
|
+
pnpm exec artifact-graph version-lock refresh --all --format markdown
|
|
33
|
+
pnpm exec artifact-graph version-lock audit --root . --strict-missing-lock
|
|
34
|
+
|
|
35
|
+
# npm
|
|
36
|
+
npx artifact-graph init --root .
|
|
37
|
+
npx artifact-graph validate --root . --warning-only
|
|
38
|
+
npx artifact-graph version-lock refresh --all --format markdown
|
|
39
|
+
npx artifact-graph version-lock audit --root . --strict-missing-lock
|
|
33
40
|
```
|
|
34
41
|
|
|
42
|
+
> Use `version-lock refresh --all` for the initial lock. The `--changed-only --staged` variant is for
|
|
43
|
+
> pre-commit hooks on existing projects — not for first-time initialization.
|
|
44
|
+
|
|
35
45
|
## Common Workflows
|
|
36
46
|
|
|
37
47
|
- Generate or inspect project artifact graph configuration with `artifact-graph init`.
|
|
@@ -45,7 +55,13 @@ artifact-graph version-lock audit --root . --strict-missing-lock
|
|
|
45
55
|
|
|
46
56
|
The package publishes `schemas/review-result.schema.json` and a matching TypeScript types + validateReviewResult validator API.
|
|
47
57
|
The protocol is project-neutral and supports review, repair, batch evidence, findings, metrics, and
|
|
48
|
-
fail-closed decisions.
|
|
58
|
+
fail-closed decisions. Unknown top-level fields are rejected; `attempt` is limited to 1–3;
|
|
59
|
+
successful acceptance requires `producer`; and `PASS`/`PASS_WITH_RESIDUAL_MINOR` cannot contain an
|
|
60
|
+
open `block` finding. Independent repair re-review can record `acceptance.reviewer` and
|
|
61
|
+
`acceptance.source_result`; the validator rejects self-acceptance by the repair producer. Invalid
|
|
62
|
+
fields and semantic violations are reported with stable JSON paths. JSON Schema cannot compare
|
|
63
|
+
cross-object field values, so callers must also run the semantic validator; stable identity is
|
|
64
|
+
`executor + name`, while `skill` is only metadata and cannot establish independence.
|
|
49
65
|
|
|
50
66
|
## Related Project
|
|
51
67
|
|
package/README.zh-CN.md
CHANGED
|
@@ -16,7 +16,7 @@ pnpm add -D artifact-graph
|
|
|
16
16
|
或从 GitHub 安装:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
npm install github:mzdbxqh/artifact-graph
|
|
19
|
+
npm install --save-dev github:mzdbxqh/artifact-graph
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
需要 Node.js `>=22.0.0`。pnpm 10+ 需要配置原生构建白名单,详见 [INSTALL.md](INSTALL.md)。
|
|
@@ -24,12 +24,22 @@ npm install github:mzdbxqh/artifact-graph
|
|
|
24
24
|
## 快速开始
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
|
|
28
|
-
artifact-graph
|
|
29
|
-
artifact-graph
|
|
30
|
-
artifact-graph version-lock
|
|
27
|
+
# pnpm
|
|
28
|
+
pnpm exec artifact-graph init --root .
|
|
29
|
+
pnpm exec artifact-graph validate --root . --warning-only
|
|
30
|
+
pnpm exec artifact-graph version-lock refresh --all --format markdown
|
|
31
|
+
pnpm exec artifact-graph version-lock audit --root . --strict-missing-lock
|
|
32
|
+
|
|
33
|
+
# npm
|
|
34
|
+
npx artifact-graph init --root .
|
|
35
|
+
npx artifact-graph validate --root . --warning-only
|
|
36
|
+
npx artifact-graph version-lock refresh --all --format markdown
|
|
37
|
+
npx artifact-graph version-lock audit --root . --strict-missing-lock
|
|
31
38
|
```
|
|
32
39
|
|
|
40
|
+
> 首次初始化版本锁使用 `version-lock refresh --all`。`--changed-only --staged` 适用于
|
|
41
|
+
> 已有项目的 pre-commit hook,不适用于首次初始化。
|
|
42
|
+
|
|
33
43
|
## 常见工作流
|
|
34
44
|
|
|
35
45
|
- 用 `artifact-graph init` 生成或检查项目制品图配置。
|
|
@@ -43,7 +53,12 @@ artifact-graph version-lock audit --root . --strict-missing-lock
|
|
|
43
53
|
|
|
44
54
|
包内发布 `schemas/review-result.schema.json` 和等价的 TypeScript 类型与 validateReviewResult 校验 API。该协议不绑定具体
|
|
45
55
|
项目,覆盖 review、repair、批次证据、findings、metrics 与 fail-closed decision;非法字段
|
|
46
|
-
会返回稳定的 JSON path
|
|
56
|
+
会返回稳定的 JSON path 诊断。协议拒绝未知顶层字段,`attempt` 仅允许 1–3;成功接受必须包含
|
|
57
|
+
`producer`,`PASS`/`PASS_WITH_RESIDUAL_MINOR` 不能伴随 open `block` finding。独立 repair
|
|
58
|
+
re-review 可记录 `acceptance.reviewer` 与 `acceptance.source_result`,validator 会拒绝 repair
|
|
59
|
+
producer 自行接受。
|
|
60
|
+
JSON Schema 无法比较跨对象字段值,因此调用方还必须运行 semantic validator;稳定身份是
|
|
61
|
+
`executor + name`,`skill` 只是附加元数据,不能用于证明独立性。
|
|
47
62
|
|
|
48
63
|
## 相关项目
|
|
49
64
|
|