artifact-graph 0.14.0 → 0.15.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,27 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.15.0
6
+
7
+ ### Added
8
+
9
+ - The package exports a static recommendation list at `artifact-graph/project-artifact-profiles`, with companion schema `artifact-graph/schemas/project-artifact-profiles.schema.json` and `schema_version` `1.0`. Common minimum types are `feature`, `scenario`, and `design`. The `skill-plugin` standard adds `agent_skill` and `e2e_test`. Lifecycle and capability entries are conditions, not auto-enable rules. Project configuration owns adoption and keeps extra types. Consumers can `require('artifact-graph/project-artifact-profiles')`.
10
+
11
+ ### Fixed
12
+
13
+ - `version-lock bootstrap` and `refresh` write one `artifactRelations` lock per relation identity when the scan graph keeps multiple source occurrences of the same artifact-to-artifact relation. Scan-graph source evidence is unchanged. A lock file that already contains duplicate `artifactRelations` is still rejected. This release does not auto-repair historically damaged duplicate locks.
14
+
15
+ ## 0.14.1
16
+
17
+ ### Fixed
18
+
19
+ - `doctor` resolves `better-sqlite3` from the installation that owns the selected `node_modules` CLI. A `.bin` shim or symlink is followed to the real package entry, and the nested dependency is loaded from that install. A pnpm consumer that installs only `artifact-graph` and allows the native build is reported from that install as a passing probe, `MISSING`, or `BUILD_DISABLED`.
20
+ - PATH, legacy, and plugin-bundled sources keep their existing anchors. `scan` and `query` still classify the running install with the same cause enum.
21
+
22
+ ### Changed
23
+
24
+ - Version lockstep with `artifact-chain-assistant` 0.14.1.
25
+
5
26
  ## 0.14.0
6
27
 
7
28
  ### Added
package/README.md CHANGED
@@ -81,6 +81,24 @@ See [Code Traceability And Coverage Boundaries](INSTALL.md#code-traceability-and
81
81
  for syntax, scan configuration, classification, exemptions and project isolation. Inspect the
82
82
  index before `refresh --all`; there is no `version-lock update --all` operation.
83
83
 
84
+ ### Published type profiles and schema
85
+
86
+ The package exports a static JSON list at the subpath `artifact-graph/project-artifact-profiles`. The companion JSON Schema is `artifact-graph/schemas/project-artifact-profiles.schema.json`. The `schema_version` field is `1.0`.
87
+
88
+ This export is available from version 0.15.0.
89
+
90
+ ```js
91
+ const profiles = require('artifact-graph/project-artifact-profiles');
92
+ ```
93
+
94
+ `common_minimum` contains exactly three types: `feature`, `scenario`, and `design`.
95
+
96
+ The only approved `project_standards` key is `skill-plugin`. It `extends` `common_minimum` and adds exactly two types: `agent_skill` and `e2e_test`.
97
+
98
+ `lifecycle` and `conditional` entries describe adoption-stage and capability conditions. Stage items and capability items remain candidates. Reading the JSON does not enable project types.
99
+
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
+
84
102
  ### JSON originals for custom types
85
103
 
86
104
  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`.
package/README.zh-CN.md CHANGED
@@ -78,6 +78,20 @@ Python 的 `#` 注释目前不受支持。
78
78
  见 [代码追溯接入说明](INSTALL.md#code-traceability-and-coverage-boundaries)。先确认索引中确有预期节点和关系,
79
79
  再运行 `refresh --all` 建立锁;不存在 `version-lock update --all` 操作。
80
80
 
81
+ ### 公开清单与采用边界
82
+
83
+ 包提供静态 JSON 清单,公开子路径是 `artifact-graph/project-artifact-profiles`,配套 Schema 是 `artifact-graph/schemas/project-artifact-profiles.schema.json`。字段 `schema_version` 的值是 `1.0`。该入口从 0.15.0 版本开始提供。
84
+
85
+ ```js
86
+ const profiles = require('artifact-graph/project-artifact-profiles');
87
+ ```
88
+
89
+ `common_minimum` 恰好三项:`feature`、`scenario`、`design`。`project_standards` 目前只有 `skill-plugin`:它 `extends` `common_minimum`,再加 `agent_skill`、`e2e_test`。
90
+
91
+ `lifecycle` 与 `conditional` 是采用阶段和能力条件。阶段项和能力项只是候选。读到这份 JSON 不会启用项目类型。
92
+
93
+ 目标项目的 `artifact-graph.config.yaml` 拥有采用权。配置或既有方法绑定里已经声明的类型都要保留,包括清单里没有的追加类型。
94
+
81
95
  ### 自定义类型的 JSON 原文件
82
96
 
83
97
  内置类型继续使用各自的专用解析。`format: json` 只写在项目自己注册的自定义类型上,同一项还要给出 `idField`。省略 `format` 时,文件仍按 Markdown 解析,扫描路径写成 `*.json` 也不改变这一规则。类型声明 `format: json` 之后,才按 JSON 读取。
package/dist/cli.js CHANGED
@@ -926,17 +926,22 @@ async function bootstrapVersionLock(root, options = {}) {
926
926
  source: sourceRefFromNode(source)
927
927
  });
928
928
  }
929
- const artifactRelationEntries = [];
929
+ const artifactRelationEntries = /* @__PURE__ */ new Map();
930
930
  for (const edge2 of artifactRelationEdges(index)) {
931
931
  const source = nodeByUid.get(edge2.from);
932
932
  const target = nodeByUid.get(edge2.to);
933
933
  if (!source || !target) continue;
934
- artifactRelationEntries.push(artifactRelationLockFromEdge(edge2, source, target));
934
+ const relationLock = artifactRelationLockFromEdge(edge2, source, target);
935
+ const identity = artifactRelationLockSortKey(relationLock);
936
+ if (artifactRelationEntries.has(identity)) {
937
+ continue;
938
+ }
939
+ artifactRelationEntries.set(identity, relationLock);
935
940
  }
936
941
  const next = {
937
942
  schemaVersion: VERSION_LOCK_SCHEMA_VERSION,
938
943
  locks: sortBy([...entries.values()], (item) => item.edgeId),
939
- artifactRelations: sortBy(artifactRelationEntries, artifactRelationLockSortKey)
944
+ artifactRelations: sortBy([...artifactRelationEntries.values()], artifactRelationLockSortKey)
940
945
  };
941
946
  await writeVersionLock(root, lockPath, next);
942
947
  return next;
@@ -3388,11 +3393,10 @@ async function detectPnpmVersion() {
3388
3393
  return void 0;
3389
3394
  }
3390
3395
  }
3391
- function bindingInstallBase(cli, root) {
3396
+ function bindingInstallBase(cli, _root) {
3392
3397
  if (!cli.path || !cli.source) return void 0;
3393
3398
  switch (cli.source) {
3394
3399
  case "node_modules":
3395
- return join5(root, "package.json");
3396
3400
  case "plugin-bundled":
3397
3401
  case "path":
3398
3402
  case "legacy":
@@ -3401,11 +3405,10 @@ function bindingInstallBase(cli, root) {
3401
3405
  return void 0;
3402
3406
  }
3403
3407
  }
3404
- function bindingInstallRoot(cli, root) {
3408
+ function bindingInstallRoot(cli, _root) {
3405
3409
  if (!cli.path || !cli.source) return void 0;
3406
3410
  switch (cli.source) {
3407
3411
  case "node_modules":
3408
- return root;
3409
3412
  case "plugin-bundled":
3410
3413
  case "path":
3411
3414
  case "legacy":
package/dist/index.cjs CHANGED
@@ -968,17 +968,22 @@ async function bootstrapVersionLock(root, options = {}) {
968
968
  source: sourceRefFromNode(source)
969
969
  });
970
970
  }
971
- const artifactRelationEntries = [];
971
+ const artifactRelationEntries = /* @__PURE__ */ new Map();
972
972
  for (const edge2 of artifactRelationEdges(index)) {
973
973
  const source = nodeByUid.get(edge2.from);
974
974
  const target = nodeByUid.get(edge2.to);
975
975
  if (!source || !target) continue;
976
- artifactRelationEntries.push(artifactRelationLockFromEdge(edge2, source, target));
976
+ const relationLock = artifactRelationLockFromEdge(edge2, source, target);
977
+ const identity = artifactRelationLockSortKey(relationLock);
978
+ if (artifactRelationEntries.has(identity)) {
979
+ continue;
980
+ }
981
+ artifactRelationEntries.set(identity, relationLock);
977
982
  }
978
983
  const next = {
979
984
  schemaVersion: VERSION_LOCK_SCHEMA_VERSION,
980
985
  locks: sortBy([...entries.values()], (item) => item.edgeId),
981
- artifactRelations: sortBy(artifactRelationEntries, artifactRelationLockSortKey)
986
+ artifactRelations: sortBy([...artifactRelationEntries.values()], artifactRelationLockSortKey)
982
987
  };
983
988
  await writeVersionLock(root, lockPath, next);
984
989
  return next;
@@ -3411,11 +3416,10 @@ async function detectPnpmVersion() {
3411
3416
  return void 0;
3412
3417
  }
3413
3418
  }
3414
- function bindingInstallBase(cli, root) {
3419
+ function bindingInstallBase(cli, _root) {
3415
3420
  if (!cli.path || !cli.source) return void 0;
3416
3421
  switch (cli.source) {
3417
3422
  case "node_modules":
3418
- return (0, import_node_path7.join)(root, "package.json");
3419
3423
  case "plugin-bundled":
3420
3424
  case "path":
3421
3425
  case "legacy":
@@ -3424,11 +3428,10 @@ function bindingInstallBase(cli, root) {
3424
3428
  return void 0;
3425
3429
  }
3426
3430
  }
3427
- function bindingInstallRoot(cli, root) {
3431
+ function bindingInstallRoot(cli, _root) {
3428
3432
  if (!cli.path || !cli.source) return void 0;
3429
3433
  switch (cli.source) {
3430
3434
  case "node_modules":
3431
- return root;
3432
3435
  case "plugin-bundled":
3433
3436
  case "path":
3434
3437
  case "legacy":
package/dist/index.js CHANGED
@@ -945,17 +945,22 @@ async function bootstrapVersionLock(root, options = {}) {
945
945
  source: sourceRefFromNode(source)
946
946
  });
947
947
  }
948
- const artifactRelationEntries = [];
948
+ const artifactRelationEntries = /* @__PURE__ */ new Map();
949
949
  for (const edge2 of artifactRelationEdges(index)) {
950
950
  const source = nodeByUid.get(edge2.from);
951
951
  const target = nodeByUid.get(edge2.to);
952
952
  if (!source || !target) continue;
953
- artifactRelationEntries.push(artifactRelationLockFromEdge(edge2, source, target));
953
+ const relationLock = artifactRelationLockFromEdge(edge2, source, target);
954
+ const identity = artifactRelationLockSortKey(relationLock);
955
+ if (artifactRelationEntries.has(identity)) {
956
+ continue;
957
+ }
958
+ artifactRelationEntries.set(identity, relationLock);
954
959
  }
955
960
  const next = {
956
961
  schemaVersion: VERSION_LOCK_SCHEMA_VERSION,
957
962
  locks: sortBy([...entries.values()], (item) => item.edgeId),
958
- artifactRelations: sortBy(artifactRelationEntries, artifactRelationLockSortKey)
963
+ artifactRelations: sortBy([...artifactRelationEntries.values()], artifactRelationLockSortKey)
959
964
  };
960
965
  await writeVersionLock(root, lockPath, next);
961
966
  return next;
@@ -3386,11 +3391,10 @@ async function detectPnpmVersion() {
3386
3391
  return void 0;
3387
3392
  }
3388
3393
  }
3389
- function bindingInstallBase(cli, root) {
3394
+ function bindingInstallBase(cli, _root) {
3390
3395
  if (!cli.path || !cli.source) return void 0;
3391
3396
  switch (cli.source) {
3392
3397
  case "node_modules":
3393
- return join5(root, "package.json");
3394
3398
  case "plugin-bundled":
3395
3399
  case "path":
3396
3400
  case "legacy":
@@ -3399,11 +3403,10 @@ function bindingInstallBase(cli, root) {
3399
3403
  return void 0;
3400
3404
  }
3401
3405
  }
3402
- function bindingInstallRoot(cli, root) {
3406
+ function bindingInstallRoot(cli, _root) {
3403
3407
  if (!cli.path || !cli.source) return void 0;
3404
3408
  switch (cli.source) {
3405
3409
  case "node_modules":
3406
- return root;
3407
3410
  case "plugin-bundled":
3408
3411
  case "path":
3409
3412
  case "legacy":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artifact-graph",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Git-native Markdown artifact graph scanner and validator",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -30,6 +30,8 @@
30
30
  }
31
31
  },
32
32
  "./schemas/review-result.schema.json": "./schemas/review-result.schema.json",
33
+ "./schemas/project-artifact-profiles.schema.json": "./schemas/project-artifact-profiles.schema.json",
34
+ "./project-artifact-profiles": "./profiles/project-artifact-profiles.json",
33
35
  "./contracts/e2e-test/schema.json": "./contracts/e2e-test/schema.json"
34
36
  },
35
37
  "engines": {
@@ -77,6 +79,7 @@
77
79
  ".github",
78
80
  "dist",
79
81
  "schemas",
82
+ "profiles",
80
83
  "contracts",
81
84
  "scripts",
82
85
  "templates"
@@ -0,0 +1,109 @@
1
+ {
2
+ "schema_version": "1.0",
3
+ "common_minimum": [
4
+ "feature",
5
+ "scenario",
6
+ "design"
7
+ ],
8
+ "project_standards": {
9
+ "skill-plugin": {
10
+ "extends": "common_minimum",
11
+ "additional_types": [
12
+ "agent_skill",
13
+ "e2e_test"
14
+ ]
15
+ }
16
+ },
17
+ "lifecycle": [
18
+ {
19
+ "type": "requirement",
20
+ "adoption_stages": [
21
+ "initial",
22
+ "daily-iteration"
23
+ ],
24
+ "condition": "项目正在收集尚待处理的诉求时采用;读取清单不会启用该类型。"
25
+ },
26
+ {
27
+ "type": "spec",
28
+ "adoption_stages": [
29
+ "daily-iteration"
30
+ ],
31
+ "condition": "需要冻结本轮跨仓或复杂实施的范围与验收时采用;读取清单不会启用该类型。"
32
+ },
33
+ {
34
+ "type": "decision",
35
+ "adoption_stages": [
36
+ "initial",
37
+ "legacy-backfill",
38
+ "daily-iteration"
39
+ ],
40
+ "condition": "需要追溯方案取舍时采用;读取清单不会启用该类型。"
41
+ }
42
+ ],
43
+ "conditional": [
44
+ {
45
+ "type": "cli_contract",
46
+ "project_shapes": [
47
+ "cli-library"
48
+ ],
49
+ "condition": "项目有公开 CLI 或独立命令接口时采用;形态本身不证明已有该能力。"
50
+ },
51
+ {
52
+ "type": "api_contract",
53
+ "project_shapes": [
54
+ "web",
55
+ "desktop"
56
+ ],
57
+ "condition": "项目有公开 API 或独立服务接口时采用;形态本身不证明已有该能力。"
58
+ },
59
+ {
60
+ "type": "ui_contract",
61
+ "project_shapes": [
62
+ "web",
63
+ "desktop"
64
+ ],
65
+ "condition": "项目有独立界面流程或 UI 合同时采用;形态本身不证明已有该能力。"
66
+ },
67
+ {
68
+ "type": "ipc_contract",
69
+ "project_shapes": [
70
+ "desktop"
71
+ ],
72
+ "condition": "项目有独立进程间通道或前后端桥接合同时采用;形态本身不证明已有该能力。"
73
+ },
74
+ {
75
+ "type": "data_contract",
76
+ "project_shapes": [
77
+ "cli-library",
78
+ "web",
79
+ "desktop",
80
+ "skill-plugin"
81
+ ],
82
+ "condition": "项目有独立数据交换或数据模型合同时采用;读取清单不会启用该类型。"
83
+ },
84
+ {
85
+ "type": "hook_policy",
86
+ "project_shapes": [
87
+ "skill-plugin"
88
+ ],
89
+ "condition": "项目有钩子、门禁或独立 hook 合同时采用;技能族标准不包含此项。"
90
+ },
91
+ {
92
+ "type": "prompt_packet",
93
+ "project_shapes": [
94
+ "skill-plugin"
95
+ ],
96
+ "condition": "项目有独立提示或上下文组装合同时采用;技能族标准不包含此项。"
97
+ },
98
+ {
99
+ "type": "release_policy",
100
+ "project_shapes": [
101
+ "cli-library",
102
+ "web",
103
+ "desktop",
104
+ "skill-plugin"
105
+ ],
106
+ "condition": "项目承担发布与分发职责时采用适用的发布治理制品;读取清单不会启用该类型。"
107
+ }
108
+ ]
109
+ }
@@ -0,0 +1,120 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://artifact-graph.dev/schemas/project-artifact-profiles/v1.0.schema.json",
4
+ "title": "Project Artifact Profiles",
5
+ "description": "Static published lists of common-minimum, project-type standard, lifecycle, and capability-triggered artifact types. schema_version must be 1.0. This file is a recommendation contract; reading it does not enable project types.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["schema_version", "common_minimum", "project_standards", "lifecycle", "conditional"],
9
+ "properties": {
10
+ "schema_version": {
11
+ "type": "string",
12
+ "const": "1.0",
13
+ "description": "Contract version. Must be '1.0' for this schema."
14
+ },
15
+ "common_minimum": {
16
+ "type": "array",
17
+ "description": "Cross-project common minimum artifact types. Unique names; not auto-enabled.",
18
+ "minItems": 1,
19
+ "uniqueItems": true,
20
+ "items": {
21
+ "type": "string",
22
+ "pattern": "^[a-z][a-z0-9_]*$"
23
+ }
24
+ },
25
+ "project_standards": {
26
+ "type": "object",
27
+ "description": "Approved project-shape standards. Only skill-plugin is currently an independent category standard.",
28
+ "additionalProperties": false,
29
+ "properties": {
30
+ "skill-plugin": {
31
+ "$ref": "#/$defs/projectStandard"
32
+ }
33
+ }
34
+ },
35
+ "lifecycle": {
36
+ "type": "array",
37
+ "description": "Stage-triggered candidates. condition is for skill interpretation; no runtime condition interpreter is implied.",
38
+ "items": {
39
+ "$ref": "#/$defs/lifecycleEntry"
40
+ }
41
+ },
42
+ "conditional": {
43
+ "type": "array",
44
+ "description": "Capability-triggered candidates for matching project shapes. Not auto-enabled.",
45
+ "items": {
46
+ "$ref": "#/$defs/conditionalEntry"
47
+ }
48
+ }
49
+ },
50
+ "$defs": {
51
+ "artifactTypeName": {
52
+ "type": "string",
53
+ "pattern": "^[a-z][a-z0-9_]*$"
54
+ },
55
+ "projectStandard": {
56
+ "type": "object",
57
+ "additionalProperties": false,
58
+ "required": ["extends", "additional_types"],
59
+ "properties": {
60
+ "extends": {
61
+ "type": "string",
62
+ "const": "common_minimum"
63
+ },
64
+ "additional_types": {
65
+ "type": "array",
66
+ "uniqueItems": true,
67
+ "items": {
68
+ "$ref": "#/$defs/artifactTypeName"
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "lifecycleEntry": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": ["type", "adoption_stages", "condition"],
77
+ "properties": {
78
+ "type": {
79
+ "$ref": "#/$defs/artifactTypeName"
80
+ },
81
+ "adoption_stages": {
82
+ "type": "array",
83
+ "minItems": 1,
84
+ "uniqueItems": true,
85
+ "items": {
86
+ "type": "string",
87
+ "enum": ["initial", "legacy-backfill", "daily-iteration"]
88
+ }
89
+ },
90
+ "condition": {
91
+ "type": "string",
92
+ "minLength": 1
93
+ }
94
+ }
95
+ },
96
+ "conditionalEntry": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["type", "project_shapes", "condition"],
100
+ "properties": {
101
+ "type": {
102
+ "$ref": "#/$defs/artifactTypeName"
103
+ },
104
+ "project_shapes": {
105
+ "type": "array",
106
+ "minItems": 1,
107
+ "uniqueItems": true,
108
+ "items": {
109
+ "type": "string",
110
+ "enum": ["cli-library", "web", "desktop", "skill-plugin"]
111
+ }
112
+ },
113
+ "condition": {
114
+ "type": "string",
115
+ "minLength": 1
116
+ }
117
+ }
118
+ }
119
+ }
120
+ }