hanlint 0.0.9 → 0.0.10
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/README.md +36 -1
- package/data/checkResult.schema.json +75 -0
- package/data/checkResultV2.schema.json +98 -0
- package/data/finding.schema.json +38 -0
- package/data/patch.schema.json +14 -0
- package/data/patchResult.schema.json +86 -0
- package/data/patchResultV2.schema.json +71 -0
- package/data/profiles.json +1 -1
- package/data/pythonPackages.txt +3 -2
- package/data/readerContract.schema.json +20 -0
- package/data/readerContractConformanceV1.json +168 -0
- package/data/readerContractV2.schema.json +64 -0
- package/data/ruleDocs.json +3 -3
- package/data/version.json +1 -1
- package/data/writingBrief.schema.json +1 -1
- package/data/writingBriefV2.schema.json +1 -1
- package/package.json +1 -1
- package/src/cli/help.js +34 -0
- package/src/cli/main.js +241 -28
- package/src/config/patch.js +48 -0
- package/src/config/readerContract.js +245 -0
- package/src/config/settings.js +31 -2
- package/src/data/profiles.js +12 -0
- package/src/fingerprint/codeMarkers.js +1 -1
- package/src/guard/contract.js +174 -0
- package/src/guard/editLocality.js +27 -0
- package/src/guard/outline.js +46 -0
- package/src/guard/receipt.js +180 -0
- package/src/guard/surface.js +184 -0
- package/src/index.js +39 -1
- package/src/report/compactReport.js +1 -1
- package/src/report/writingSpec.js +174 -0
- package/src/rules/code/inputFileSource.js +5 -3
- package/src/rules/code/installImport.js +6 -5
- package/src/rules/document/noQuestion.js +4 -4
- package/src/rules/readerDebt.js +9 -0
- package/src/rules/registry.js +27 -0
- package/src/rules/sentence/nounPile.js +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,13 @@ npx hanlint
|
|
|
9
9
|
npx hanlint 글.md
|
|
10
10
|
npx hanlint fix 글.md
|
|
11
11
|
npx hanlint 글.md --format compact --errors-only
|
|
12
|
+
npx hanlint spec --preset blog --register 합니다 --chars 800
|
|
13
|
+
npx hanlint hook
|
|
14
|
+
npx hanlint hook --reply
|
|
15
|
+
npx hanlint contract init 초안.md --reader "배포를 결정할 운영자" --goal "예산을 확인한다"
|
|
16
|
+
npx hanlint contract init 초안.md --reader "개발자" --goal "섹션별로 비교한다" --outline h2
|
|
17
|
+
npx hanlint check contract.json 초안.md --format text
|
|
18
|
+
npx hanlint verify-patch contract.json 초안.md patch.json
|
|
12
19
|
```
|
|
13
20
|
|
|
14
21
|
인자 없이 치면 첫 화면이 나온다. 이 폴더의 마크다운 이름으로 만든 예시와 지금 칠 수 있는 명령이 거기 있다.
|
|
@@ -33,12 +40,40 @@ npx hanlint 글.md --format compact --errors-only
|
|
|
33
40
|
규칙을 끈 설정 파일을 만든다. `blog`, `report`, `docs`, `guide`, `essay`, `fiction`, `encyclopedia` 일곱이고
|
|
34
41
|
`npx hanlint rules` 가 지금 도는 목록을 낸다.
|
|
35
42
|
|
|
43
|
+
글을 쓰기 전에는 `npx hanlint spec --preset <종류> --chars <글자 수>`로 같은 규칙판에서 숫자 사양을 받는다.
|
|
44
|
+
배포 프로파일에서 관찰한 값과 현재 켜진 규칙 임계를 함께 낸다. JSON의 `rows[].basis`가 각 수의 정본을 밝힌다.
|
|
45
|
+
새 점수나 품질 판정은 만들지 않는다. `chat`은 견줄 프로파일이 없어 사양을 내지 않는다.
|
|
46
|
+
|
|
47
|
+
Claude Code의 PostToolUse JSON을 stdin으로 `npx hanlint hook`에 연결하면 `Edit|Write`가 저장한 마크다운
|
|
48
|
+
한 파일을 검사한다. Finding이 있을 때만 다음 모델 요청용 `additionalContext` JSON을 내며 언제나 종료 코드
|
|
49
|
+
0이라 쓰기를 막지 않는다. Stop에는 `npx hanlint hook --reply`를 연결한다. 마지막 답변을 `chat` 프리셋으로
|
|
50
|
+
한 번 검사하고 `stop_hook_active` 재진입에서는 침묵한다. 전체 `.claude/settings.json` 예시는 루트 README에 있다.
|
|
51
|
+
|
|
36
52
|
```js
|
|
37
|
-
import { lintFile } from "hanlint";
|
|
53
|
+
import { Contract, Patch, check, contractFromText, contractFromTextV2, lintFile, renderCheck, verifyPatch } from "hanlint";
|
|
38
54
|
|
|
39
55
|
for (const finding of lintFile("글.md")) console.log(finding.line, finding.rule, finding.why);
|
|
56
|
+
|
|
57
|
+
const draftContract = contractFromText(text, "배포를 결정할 운영자", "예산을 확인한다");
|
|
58
|
+
const structuredContract = contractFromTextV2(text, "개발자", "섹션별로 비교한다", 2);
|
|
59
|
+
const contract = new Contract("배포를 결정할 운영자", "예산을 확인한다", ["예산은 380,000원이다."]);
|
|
60
|
+
const receipt = check(text, contract);
|
|
61
|
+
console.log(renderCheck(check(text, structuredContract)));
|
|
62
|
+
const patch = new Patch("unexpectedNumbers", "400,000", "380,000");
|
|
63
|
+
const verified = verifyPatch(text, patch, contract);
|
|
40
64
|
```
|
|
41
65
|
|
|
66
|
+
Reader Contract는 `reader`, `goal`, `facts`에서 숫자, URL, 인라인 코드와 링크 목적지를 자동으로 보호한다.
|
|
67
|
+
`contractFromText`와 `contract init`은 보호 원자를 많이 덮는 원문 줄부터 골라 facts 후보를 줄인다.
|
|
68
|
+
사실의 진실과 보호 원자가 없는 의미는 추측하지 않으므로 사람이 초안을 확인한다.
|
|
69
|
+
제목 수와 순서가 요구사항이면 `contractFromTextV2` 또는 `contract init --outline h2`를 쓴다. version 2는
|
|
70
|
+
사람이 승인한 facts, 자동으로 모은 surface, 한 수준의 정확한 outline을 분리한다. `check --format text`는
|
|
71
|
+
보호 원자, 제목 구조, 전체 절 제목, lint와 다음 행동을 한 화면에 보여 준다.
|
|
72
|
+
check 결과는 Contract와 초안 해시, 보호 원자 차이와 기존 Finding을 담는다. Patch는 원문 한 자리에 정확히
|
|
73
|
+
맞고 명시한 기존 위반을 줄이며 새 보호 원자 위반과 새 error를 만들지 않을 때만 검증된다. 이 조건은 의미나
|
|
74
|
+
진실, 자연스러움의 승인이 아니다. version 2 Patch는 새 outline 위반도 거부한다. Python과 npm은 배포물의
|
|
75
|
+
같은 version 1 적합성 JSON을 독립 실행하고 version 2 결과도 동등성 게이트로 견준다.
|
|
76
|
+
|
|
42
77
|
파이썬 패키지 (`pip install hanlint`) 와 같은 규칙, 같은 fixture, 같은 출력이다. 지문 지도 (`audit`, `map`),
|
|
43
78
|
문체 프로파일, 초안 비교 (`diff`), 평가자 겹침 (`coverage`) 은 파이썬 쪽에만 있다. 무엇을 잡고 무엇을 잡지 않는지는
|
|
44
79
|
[전체 사용 안내](https://github.com/eddmpython/hanlint#readme)와
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hanlint.dev/schemas/checkResult.schema.json",
|
|
4
|
+
"title": "hanlint Check Result",
|
|
5
|
+
"description": "A deterministic receipt for a Reader Contract and a prose draft.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"version",
|
|
10
|
+
"kind",
|
|
11
|
+
"violationCount",
|
|
12
|
+
"contractSha256",
|
|
13
|
+
"draftSha256",
|
|
14
|
+
"surface",
|
|
15
|
+
"lint",
|
|
16
|
+
"meaning"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"version": { "const": 1 },
|
|
20
|
+
"kind": { "const": "hanlint.checkResult" },
|
|
21
|
+
"violationCount": { "type": "integer", "minimum": 0 },
|
|
22
|
+
"contractSha256": { "$ref": "#/$defs/sha256" },
|
|
23
|
+
"draftSha256": { "$ref": "#/$defs/sha256" },
|
|
24
|
+
"surface": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": [
|
|
28
|
+
"missingNumbers",
|
|
29
|
+
"unexpectedNumbers",
|
|
30
|
+
"missingUrls",
|
|
31
|
+
"unexpectedUrls",
|
|
32
|
+
"missingCode",
|
|
33
|
+
"unexpectedCode",
|
|
34
|
+
"missingLinks",
|
|
35
|
+
"unexpectedLinks"
|
|
36
|
+
],
|
|
37
|
+
"properties": {
|
|
38
|
+
"missingNumbers": { "$ref": "#/$defs/strings" },
|
|
39
|
+
"unexpectedNumbers": { "$ref": "#/$defs/strings" },
|
|
40
|
+
"missingUrls": { "$ref": "#/$defs/strings" },
|
|
41
|
+
"unexpectedUrls": { "$ref": "#/$defs/strings" },
|
|
42
|
+
"missingCode": { "$ref": "#/$defs/strings" },
|
|
43
|
+
"unexpectedCode": { "$ref": "#/$defs/strings" },
|
|
44
|
+
"missingLinks": { "$ref": "#/$defs/strings" },
|
|
45
|
+
"unexpectedLinks": { "$ref": "#/$defs/strings" }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"lint": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": ["errorCount", "noticeCount", "errorRules", "items"],
|
|
52
|
+
"properties": {
|
|
53
|
+
"errorCount": { "type": "integer", "minimum": 0 },
|
|
54
|
+
"noticeCount": { "type": "integer", "minimum": 0 },
|
|
55
|
+
"errorRules": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": { "type": "integer", "minimum": 1 }
|
|
58
|
+
},
|
|
59
|
+
"items": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": { "$ref": "finding.schema.json" }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"meaning": { "type": "string", "minLength": 1 }
|
|
66
|
+
},
|
|
67
|
+
"$defs": {
|
|
68
|
+
"sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
69
|
+
"strings": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"uniqueItems": true,
|
|
72
|
+
"items": { "type": "string", "minLength": 1 }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hanlint.dev/schemas/checkResultV2.schema.json",
|
|
4
|
+
"title": "hanlint Check Result v2",
|
|
5
|
+
"description": "A deterministic receipt for protected surface atoms, an exact heading outline, document shape, and lint findings.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"version",
|
|
10
|
+
"kind",
|
|
11
|
+
"violationCount",
|
|
12
|
+
"contractSha256",
|
|
13
|
+
"draftSha256",
|
|
14
|
+
"surface",
|
|
15
|
+
"missingFacts",
|
|
16
|
+
"lint",
|
|
17
|
+
"meaning",
|
|
18
|
+
"outline",
|
|
19
|
+
"document"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"version": { "const": 2 },
|
|
23
|
+
"kind": { "const": "hanlint.checkResult" },
|
|
24
|
+
"violationCount": { "type": "integer", "minimum": 0 },
|
|
25
|
+
"contractSha256": { "$ref": "#/$defs/sha256" },
|
|
26
|
+
"draftSha256": { "$ref": "#/$defs/sha256" },
|
|
27
|
+
"missingFacts": { "type": "array", "items": { "type": "string" } },
|
|
28
|
+
"surface": { "$ref": "checkResult.schema.json#/properties/surface" },
|
|
29
|
+
"lint": { "$ref": "checkResult.schema.json#/properties/lint" },
|
|
30
|
+
"meaning": { "type": "string", "minLength": 1 },
|
|
31
|
+
"outline": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["matches", "level", "expected", "actual", "mismatches"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"matches": { "type": "boolean" },
|
|
37
|
+
"level": { "type": "integer", "minimum": 1, "maximum": 6 },
|
|
38
|
+
"expected": { "$ref": "#/$defs/strings" },
|
|
39
|
+
"actual": { "$ref": "#/$defs/strings" },
|
|
40
|
+
"mismatches": {
|
|
41
|
+
"type": "array",
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"additionalProperties": false,
|
|
45
|
+
"required": ["position", "expected", "actual"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"position": { "type": "integer", "minimum": 1 },
|
|
48
|
+
"expected": { "type": ["string", "null"] },
|
|
49
|
+
"actual": { "type": ["string", "null"] }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"document": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": [
|
|
59
|
+
"sentenceCount",
|
|
60
|
+
"paragraphCount",
|
|
61
|
+
"sectionCount",
|
|
62
|
+
"wordCount",
|
|
63
|
+
"questionCount",
|
|
64
|
+
"readerCallCount",
|
|
65
|
+
"sections"
|
|
66
|
+
],
|
|
67
|
+
"properties": {
|
|
68
|
+
"sentenceCount": { "type": "integer", "minimum": 0 },
|
|
69
|
+
"paragraphCount": { "type": "integer", "minimum": 0 },
|
|
70
|
+
"sectionCount": { "type": "integer", "minimum": 0 },
|
|
71
|
+
"wordCount": { "type": "integer", "minimum": 0 },
|
|
72
|
+
"questionCount": { "type": "integer", "minimum": 0 },
|
|
73
|
+
"readerCallCount": { "type": "integer", "minimum": 0 },
|
|
74
|
+
"sections": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"additionalProperties": false,
|
|
79
|
+
"required": ["heading", "line", "paragraphCount", "codeBlockCount"],
|
|
80
|
+
"properties": {
|
|
81
|
+
"heading": { "type": "string" },
|
|
82
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
83
|
+
"paragraphCount": { "type": "integer", "minimum": 0 },
|
|
84
|
+
"codeBlockCount": { "type": "integer", "minimum": 0 }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"$defs": {
|
|
92
|
+
"sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
93
|
+
"strings": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"items": { "type": "string" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hanlint.dev/schemas/finding.schema.json",
|
|
4
|
+
"title": "hanlint Finding",
|
|
5
|
+
"description": "A deterministic prose issue with its location, reason, and optional local repair data.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["rule", "line", "severity", "scope", "at", "quote", "why"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"rule": { "type": "string", "minLength": 1 },
|
|
11
|
+
"line": { "type": "integer", "minimum": 1 },
|
|
12
|
+
"severity": { "enum": ["error", "notice"] },
|
|
13
|
+
"scope": { "enum": ["sentence", "paragraph", "section", "document"] },
|
|
14
|
+
"at": { "type": "integer", "minimum": -1 },
|
|
15
|
+
"quote": { "type": "string", "minLength": 1 },
|
|
16
|
+
"why": { "type": "string", "minLength": 1 },
|
|
17
|
+
"fix": { "type": "string", "minLength": 1 },
|
|
18
|
+
"fragment": { "type": ["string", "null"] },
|
|
19
|
+
"replacement": { "type": "string" },
|
|
20
|
+
"candidates": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"minItems": 1,
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": ["text", "why"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"text": { "type": "string", "minLength": 1 },
|
|
29
|
+
"why": { "type": "string", "minLength": 1 }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependentRequired": {
|
|
35
|
+
"fragment": ["replacement"],
|
|
36
|
+
"replacement": ["fragment"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hanlint.dev/schemas/patch.schema.json",
|
|
4
|
+
"title": "hanlint Patch",
|
|
5
|
+
"description": "An exact local replacement connected to a named existing violation.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["reason", "before", "after"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"reason": { "type": "string", "minLength": 1 },
|
|
11
|
+
"before": { "type": "string", "minLength": 1 },
|
|
12
|
+
"after": { "type": "string", "minLength": 1 }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hanlint.dev/schemas/patchResult.schema.json",
|
|
4
|
+
"title": "hanlint Patch Result",
|
|
5
|
+
"description": "A deterministic verification receipt for an exact prose Patch.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"version",
|
|
10
|
+
"kind",
|
|
11
|
+
"verified",
|
|
12
|
+
"violationCount",
|
|
13
|
+
"contractSha256",
|
|
14
|
+
"sourceSha256",
|
|
15
|
+
"patchSha256",
|
|
16
|
+
"resultSha256",
|
|
17
|
+
"matchCount",
|
|
18
|
+
"reason",
|
|
19
|
+
"newSurfaceIssues",
|
|
20
|
+
"newErrors",
|
|
21
|
+
"meaning"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"version": { "const": 1 },
|
|
25
|
+
"kind": { "const": "hanlint.patchResult" },
|
|
26
|
+
"verified": { "type": "boolean" },
|
|
27
|
+
"violationCount": { "type": "integer", "minimum": 0 },
|
|
28
|
+
"contractSha256": { "$ref": "#/$defs/sha256" },
|
|
29
|
+
"sourceSha256": { "$ref": "#/$defs/sha256" },
|
|
30
|
+
"patchSha256": { "$ref": "#/$defs/sha256" },
|
|
31
|
+
"resultSha256": {
|
|
32
|
+
"oneOf": [
|
|
33
|
+
{ "$ref": "#/$defs/sha256" },
|
|
34
|
+
{ "type": "null" }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"matchCount": { "type": "integer", "minimum": 0 },
|
|
38
|
+
"reason": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"required": ["name", "before", "after", "reduced"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"name": { "type": "string", "minLength": 1 },
|
|
44
|
+
"before": { "type": "integer", "minimum": 0 },
|
|
45
|
+
"after": {
|
|
46
|
+
"oneOf": [
|
|
47
|
+
{ "type": "integer", "minimum": 0 },
|
|
48
|
+
{ "type": "null" }
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"reduced": { "type": "boolean" }
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"newSurfaceIssues": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"required": ["kind", "value"],
|
|
60
|
+
"properties": {
|
|
61
|
+
"kind": {
|
|
62
|
+
"enum": [
|
|
63
|
+
"missingNumbers",
|
|
64
|
+
"unexpectedNumbers",
|
|
65
|
+
"missingUrls",
|
|
66
|
+
"unexpectedUrls",
|
|
67
|
+
"missingCode",
|
|
68
|
+
"unexpectedCode",
|
|
69
|
+
"missingLinks",
|
|
70
|
+
"unexpectedLinks"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"value": { "type": "string", "minLength": 1 }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"newErrors": {
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": { "$ref": "finding.schema.json" }
|
|
80
|
+
},
|
|
81
|
+
"meaning": { "type": "string", "minLength": 1 }
|
|
82
|
+
},
|
|
83
|
+
"$defs": {
|
|
84
|
+
"sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://hanlint.dev/schemas/patchResultV2.schema.json",
|
|
4
|
+
"title": "hanlint Patch Result v2",
|
|
5
|
+
"description": "A deterministic verification receipt for a version 2 Reader Contract patch.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"version",
|
|
10
|
+
"kind",
|
|
11
|
+
"verified",
|
|
12
|
+
"violationCount",
|
|
13
|
+
"contractSha256",
|
|
14
|
+
"sourceSha256",
|
|
15
|
+
"patchSha256",
|
|
16
|
+
"resultSha256",
|
|
17
|
+
"matchCount",
|
|
18
|
+
"reason",
|
|
19
|
+
"newContractIssues",
|
|
20
|
+
"newErrors",
|
|
21
|
+
"meaning"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"version": { "const": 2 },
|
|
25
|
+
"kind": { "const": "hanlint.patchResult" },
|
|
26
|
+
"verified": { "type": "boolean" },
|
|
27
|
+
"violationCount": { "type": "integer", "minimum": 0 },
|
|
28
|
+
"contractSha256": { "$ref": "patchResult.schema.json#/$defs/sha256" },
|
|
29
|
+
"sourceSha256": { "$ref": "patchResult.schema.json#/$defs/sha256" },
|
|
30
|
+
"patchSha256": { "$ref": "patchResult.schema.json#/$defs/sha256" },
|
|
31
|
+
"resultSha256": {
|
|
32
|
+
"oneOf": [
|
|
33
|
+
{ "$ref": "patchResult.schema.json#/$defs/sha256" },
|
|
34
|
+
{ "type": "null" }
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"matchCount": { "type": "integer", "minimum": 0 },
|
|
38
|
+
"reason": { "$ref": "patchResult.schema.json#/properties/reason" },
|
|
39
|
+
"newContractIssues": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"items": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"required": ["kind", "value"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"kind": {
|
|
47
|
+
"enum": [
|
|
48
|
+
"missingNumbers",
|
|
49
|
+
"unexpectedNumbers",
|
|
50
|
+
"missingUrls",
|
|
51
|
+
"unexpectedUrls",
|
|
52
|
+
"missingCode",
|
|
53
|
+
"unexpectedCode",
|
|
54
|
+
"missingLinks",
|
|
55
|
+
"unexpectedLinks",
|
|
56
|
+
"outline",
|
|
57
|
+
"lockedFacts",
|
|
58
|
+
"editPolicy"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"value": { "type": "string", "minLength": 1 }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"newErrors": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": { "$ref": "finding.schema.json" }
|
|
68
|
+
},
|
|
69
|
+
"meaning": { "type": "string", "minLength": 1 }
|
|
70
|
+
}
|
|
71
|
+
}
|