Files
.pouch/skills/ack/templates/knowledge.schema.json
T

368 lines
8.6 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://git.yumee.top/laily/skills/skills/ack/templates/knowledge.schema.json",
"title": "ACK project knowledge guardrails",
"description": "docs/ack/knowledge.yaml 的权威结构。知识只描述约束和验证引用,不保存可执行命令。",
"type": "object",
"required": ["version", "updatedAt", "project", "verificationRegistry", "entries"],
"additionalProperties": false,
"properties": {
"version": {
"type": "integer",
"minimum": 1
},
"updatedAt": {
"type": "string",
"format": "date-time"
},
"project": {
"type": "object",
"required": ["name"],
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
}
},
"verificationRegistry": {
"type": "object",
"propertyNames": {
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
},
"additionalProperties": {
"$ref": "#/definitions/verificationTarget"
}
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/entry"
}
}
},
"definitions": {
"stableRef": {
"type": "string",
"pattern": "^K-[A-Z0-9][A-Z0-9-]*@[1-9][0-9]*$"
},
"stringSet": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
},
"scope": {
"type": "object",
"required": [
"all",
"components",
"paths",
"dependencies",
"versions",
"tags",
"symbols",
"errorSignatures"
],
"additionalProperties": false,
"properties": {
"all": {
"type": "boolean"
},
"components": {
"$ref": "#/definitions/stringSet"
},
"paths": {
"$ref": "#/definitions/stringSet"
},
"dependencies": {
"$ref": "#/definitions/stringSet"
},
"versions": {
"$ref": "#/definitions/stringSet"
},
"tags": {
"$ref": "#/definitions/stringSet"
},
"symbols": {
"$ref": "#/definitions/stringSet"
},
"errorSignatures": {
"$ref": "#/definitions/stringSet"
}
}
},
"verification": {
"type": "object",
"required": ["ref", "expected"],
"additionalProperties": false,
"properties": {
"ref": {
"type": "string",
"minLength": 1,
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$"
},
"expected": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
}
},
"verificationTarget": {
"type": "object",
"required": ["path", "args"],
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"minLength": 1,
"pattern": "^(?=.*\\S)[A-Za-z0-9][A-Za-z0-9._/-]*$",
"description": "项目内可执行文件;运行时 cwd 为项目根,脚本不得依赖自身文件路径定位资源"
},
"args": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"provenance": {
"type": "object",
"required": ["taskId", "attemptId", "codeRef", "evidenceRef"],
"additionalProperties": false,
"properties": {
"taskId": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"attemptId": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"codeRef": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"evidenceRef": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
}
},
"entry": {
"type": "object",
"required": [
"id",
"revision",
"kind",
"status",
"title",
"subject",
"scope",
"appliesWhen",
"directive",
"rationale",
"verification",
"provenance",
"owner",
"author",
"reviewer",
"approval",
"createdAt",
"lastValidatedAt",
"reviewAfter",
"temporary",
"removalCondition",
"statusReason",
"supersedes",
"conflictsWith"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^K-[A-Z0-9][A-Z0-9-]*$"
},
"revision": {
"type": "integer",
"minimum": 1
},
"kind": {
"type": "string",
"enum": ["guardrail", "pitfall", "verification"]
},
"status": {
"type": "string",
"enum": ["active", "stale", "superseded", "archived"]
},
"title": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"subject": {
"type": "string",
"minLength": 1,
"pattern": "^[a-z0-9][a-z0-9-]*$"
},
"scope": {
"$ref": "#/definitions/scope"
},
"appliesWhen": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"directive": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"rationale": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"verification": {
"$ref": "#/definitions/verification"
},
"provenance": {
"$ref": "#/definitions/provenance"
},
"owner": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"author": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"reviewer": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"approval": {
"oneOf": [
{ "type": "null" },
{ "$ref": "#/definitions/approval" }
]
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"lastValidatedAt": {
"type": "string",
"format": "date-time"
},
"reviewAfter": {
"type": ["string", "null"],
"format": "date-time"
},
"temporary": {
"type": "boolean"
},
"removalCondition": {
"type": ["string", "null"],
"minLength": 1,
"pattern": "\\S"
},
"statusReason": {
"type": ["string", "null"],
"minLength": 1,
"pattern": "\\S"
},
"supersedes": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/stableRef"
}
},
"conflictsWith": {
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/stableRef"
}
}
},
"allOf": [
{
"if": {
"properties": {
"temporary": {
"const": true
}
}
},
"then": {
"properties": {
"reviewAfter": {
"type": "string",
"format": "date-time"
},
"removalCondition": {
"type": "string",
"minLength": 1
}
}
}
},
{
"if": {
"properties": {
"status": {
"enum": ["stale", "superseded", "archived"]
}
}
},
"then": {
"properties": {
"statusReason": {
"type": "string",
"minLength": 1
}
}
}
}
]
},
"approval": {
"type": "object",
"required": ["approvedBy", "approvedAt", "evidenceRef"],
"additionalProperties": false,
"properties": {
"approvedBy": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
},
"approvedAt": {
"type": "string",
"format": "date-time"
},
"evidenceRef": {
"type": "string",
"minLength": 1,
"pattern": "\\S"
}
}
}
}
}