kibi-cli 0.11.3 → 0.12.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/dist/public/schemas/entity.d.ts +1 -127
- package/dist/public/schemas/entity.d.ts.map +1 -1
- package/dist/public/schemas/entity.js +79 -2
- package/dist/public/schemas/relationship.d.ts.map +1 -1
- package/dist/public/schemas/relationship.js +1 -0
- package/dist/schemas/entity.schema.json +81 -4
- package/dist/types/entities.d.ts +11 -2
- package/dist/types/entities.d.ts.map +1 -1
- package/dist/types/relationships.d.ts +1 -1
- package/dist/types/relationships.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/public/schemas/entity.ts +89 -5
- package/src/public/schemas/relationship.ts +1 -0
- package/src/schemas/entity.schema.json +81 -4
- package/src/schemas/relationship.schema.json +1 -0
|
@@ -1,129 +1,3 @@
|
|
|
1
|
-
declare const entitySchema:
|
|
2
|
-
$id: string;
|
|
3
|
-
title: string;
|
|
4
|
-
type: string;
|
|
5
|
-
properties: {
|
|
6
|
-
id: {
|
|
7
|
-
type: string;
|
|
8
|
-
};
|
|
9
|
-
title: {
|
|
10
|
-
type: string;
|
|
11
|
-
};
|
|
12
|
-
status: {
|
|
13
|
-
type: string;
|
|
14
|
-
enum: string[];
|
|
15
|
-
};
|
|
16
|
-
created_at: {
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
updated_at: {
|
|
20
|
-
type: string;
|
|
21
|
-
};
|
|
22
|
-
source: {
|
|
23
|
-
type: string;
|
|
24
|
-
};
|
|
25
|
-
tags: {
|
|
26
|
-
type: string;
|
|
27
|
-
items: {
|
|
28
|
-
type: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
owner: {
|
|
32
|
-
type: string;
|
|
33
|
-
};
|
|
34
|
-
priority: {
|
|
35
|
-
type: string;
|
|
36
|
-
};
|
|
37
|
-
severity: {
|
|
38
|
-
type: string;
|
|
39
|
-
};
|
|
40
|
-
links: {
|
|
41
|
-
type: string;
|
|
42
|
-
items: {
|
|
43
|
-
type: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
text_ref: {
|
|
47
|
-
type: string;
|
|
48
|
-
};
|
|
49
|
-
sourceFile: {
|
|
50
|
-
type: string;
|
|
51
|
-
};
|
|
52
|
-
type: {
|
|
53
|
-
type: string;
|
|
54
|
-
enum: string[];
|
|
55
|
-
};
|
|
56
|
-
fact_kind: {
|
|
57
|
-
type: string;
|
|
58
|
-
enum: string[];
|
|
59
|
-
};
|
|
60
|
-
subject_key: {
|
|
61
|
-
type: string;
|
|
62
|
-
};
|
|
63
|
-
property_key: {
|
|
64
|
-
type: string;
|
|
65
|
-
};
|
|
66
|
-
operator: {
|
|
67
|
-
type: string;
|
|
68
|
-
enum: string[];
|
|
69
|
-
};
|
|
70
|
-
value_type: {
|
|
71
|
-
type: string;
|
|
72
|
-
enum: string[];
|
|
73
|
-
};
|
|
74
|
-
value_string: {
|
|
75
|
-
type: string;
|
|
76
|
-
};
|
|
77
|
-
value_int: {
|
|
78
|
-
type: string;
|
|
79
|
-
};
|
|
80
|
-
value_number: {
|
|
81
|
-
type: string;
|
|
82
|
-
};
|
|
83
|
-
value_bool: {
|
|
84
|
-
type: string;
|
|
85
|
-
};
|
|
86
|
-
unit: {
|
|
87
|
-
type: string;
|
|
88
|
-
};
|
|
89
|
-
scope: {
|
|
90
|
-
type: string;
|
|
91
|
-
};
|
|
92
|
-
polarity: {
|
|
93
|
-
type: string;
|
|
94
|
-
enum: string[];
|
|
95
|
-
};
|
|
96
|
-
closed_world: {
|
|
97
|
-
type: string;
|
|
98
|
-
};
|
|
99
|
-
valid_from: {
|
|
100
|
-
type: string;
|
|
101
|
-
};
|
|
102
|
-
valid_to: {
|
|
103
|
-
type: string;
|
|
104
|
-
};
|
|
105
|
-
canonical_key: {
|
|
106
|
-
type: string;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
required: string[];
|
|
110
|
-
allOf: {
|
|
111
|
-
if: {
|
|
112
|
-
properties: {
|
|
113
|
-
type: {
|
|
114
|
-
const: string;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
else: {
|
|
119
|
-
not: {
|
|
120
|
-
anyOf: {
|
|
121
|
-
required: string[];
|
|
122
|
-
}[];
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
}[];
|
|
126
|
-
additionalProperties: boolean;
|
|
127
|
-
};
|
|
1
|
+
declare const entitySchema: Record<string, unknown>;
|
|
128
2
|
export default entitySchema;
|
|
129
3
|
//# sourceMappingURL=entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/entity.ts"],"names":[],"mappings":"AA+EA,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAkJzC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -15,6 +15,54 @@
|
|
|
15
15
|
You should have received a copy of the GNU Affero General Public License
|
|
16
16
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
|
+
const factConditionals = JSON.parse(`[
|
|
19
|
+
{
|
|
20
|
+
"if": {
|
|
21
|
+
"properties": {
|
|
22
|
+
"type": { "const": "fact" },
|
|
23
|
+
"fact_kind": { "const": "predicate_schema" }
|
|
24
|
+
},
|
|
25
|
+
"required": ["type", "fact_kind"]
|
|
26
|
+
},
|
|
27
|
+
"then": {
|
|
28
|
+
"required": [
|
|
29
|
+
"predicate_name",
|
|
30
|
+
"predicate_arity",
|
|
31
|
+
"argument_names",
|
|
32
|
+
"argument_types"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"if": {
|
|
38
|
+
"properties": {
|
|
39
|
+
"type": { "const": "fact" },
|
|
40
|
+
"fact_kind": { "const": "predicate" }
|
|
41
|
+
},
|
|
42
|
+
"required": ["type", "fact_kind"]
|
|
43
|
+
},
|
|
44
|
+
"then": {
|
|
45
|
+
"required": ["predicate_name", "predicate_args", "canonical_key"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"polarity": { "enum": ["assert", "deny"] }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"if": {
|
|
53
|
+
"properties": {
|
|
54
|
+
"type": { "const": "fact" },
|
|
55
|
+
"fact_kind": { "const": "property_value" }
|
|
56
|
+
},
|
|
57
|
+
"required": ["type", "fact_kind"]
|
|
58
|
+
},
|
|
59
|
+
"then": {
|
|
60
|
+
"properties": {
|
|
61
|
+
"polarity": { "enum": ["require", "forbid"] }
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]`);
|
|
18
66
|
const entitySchema = {
|
|
19
67
|
$id: "entity.schema.json",
|
|
20
68
|
title: "Entity",
|
|
@@ -72,7 +120,14 @@ const entitySchema = {
|
|
|
72
120
|
// Typed fact fields - only valid when type === "fact"
|
|
73
121
|
fact_kind: {
|
|
74
122
|
type: "string",
|
|
75
|
-
enum: [
|
|
123
|
+
enum: [
|
|
124
|
+
"subject",
|
|
125
|
+
"property_value",
|
|
126
|
+
"observation",
|
|
127
|
+
"meta",
|
|
128
|
+
"predicate_schema",
|
|
129
|
+
"predicate",
|
|
130
|
+
],
|
|
76
131
|
},
|
|
77
132
|
subject_key: { type: "string" },
|
|
78
133
|
property_key: { type: "string" },
|
|
@@ -84,11 +139,23 @@ const entitySchema = {
|
|
|
84
139
|
value_bool: { type: "boolean" },
|
|
85
140
|
unit: { type: "string" },
|
|
86
141
|
scope: { type: "string" },
|
|
87
|
-
polarity: {
|
|
142
|
+
polarity: {
|
|
143
|
+
type: "string",
|
|
144
|
+
enum: ["require", "forbid", "assert", "deny"],
|
|
145
|
+
},
|
|
88
146
|
closed_world: { type: "boolean" },
|
|
89
147
|
valid_from: { type: "string" },
|
|
90
148
|
valid_to: { type: "string" },
|
|
91
149
|
canonical_key: { type: "string" },
|
|
150
|
+
predicate_name: { type: "string" },
|
|
151
|
+
predicate_namespace: { type: "string" },
|
|
152
|
+
predicate_arity: { type: "integer", minimum: 1 },
|
|
153
|
+
argument_names: { type: "array", items: { type: "string" } },
|
|
154
|
+
argument_types: { type: "array", items: { type: "string" } },
|
|
155
|
+
argument_descriptions: { type: "array", items: { type: "string" } },
|
|
156
|
+
aliases: { type: "array", items: { type: "string" } },
|
|
157
|
+
examples: { type: "array", items: { type: "string" } },
|
|
158
|
+
predicate_args: { type: "array", items: { type: "string" } },
|
|
92
159
|
},
|
|
93
160
|
required: [
|
|
94
161
|
"id",
|
|
@@ -126,10 +193,20 @@ const entitySchema = {
|
|
|
126
193
|
{ required: ["valid_from"] },
|
|
127
194
|
{ required: ["valid_to"] },
|
|
128
195
|
{ required: ["canonical_key"] },
|
|
196
|
+
{ required: ["predicate_name"] },
|
|
197
|
+
{ required: ["predicate_namespace"] },
|
|
198
|
+
{ required: ["predicate_arity"] },
|
|
199
|
+
{ required: ["argument_names"] },
|
|
200
|
+
{ required: ["argument_types"] },
|
|
201
|
+
{ required: ["argument_descriptions"] },
|
|
202
|
+
{ required: ["aliases"] },
|
|
203
|
+
{ required: ["examples"] },
|
|
204
|
+
{ required: ["predicate_args"] },
|
|
129
205
|
],
|
|
130
206
|
},
|
|
131
207
|
},
|
|
132
208
|
},
|
|
209
|
+
...factConditionals,
|
|
133
210
|
],
|
|
134
211
|
additionalProperties: false,
|
|
135
212
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/public/schemas/relationship.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCvB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -62,7 +62,14 @@
|
|
|
62
62
|
},
|
|
63
63
|
"fact_kind": {
|
|
64
64
|
"type": "string",
|
|
65
|
-
"enum": [
|
|
65
|
+
"enum": [
|
|
66
|
+
"subject",
|
|
67
|
+
"property_value",
|
|
68
|
+
"observation",
|
|
69
|
+
"meta",
|
|
70
|
+
"predicate_schema",
|
|
71
|
+
"predicate"
|
|
72
|
+
]
|
|
66
73
|
},
|
|
67
74
|
"subject_key": { "type": "string" },
|
|
68
75
|
"property_key": { "type": "string" },
|
|
@@ -80,11 +87,26 @@
|
|
|
80
87
|
"value_bool": { "type": "boolean" },
|
|
81
88
|
"unit": { "type": "string" },
|
|
82
89
|
"scope": { "type": "string" },
|
|
83
|
-
"polarity": {
|
|
90
|
+
"polarity": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"enum": ["require", "forbid", "assert", "deny"]
|
|
93
|
+
},
|
|
84
94
|
"closed_world": { "type": "boolean" },
|
|
85
95
|
"valid_from": { "type": "string" },
|
|
86
96
|
"valid_to": { "type": "string" },
|
|
87
|
-
"canonical_key": { "type": "string" }
|
|
97
|
+
"canonical_key": { "type": "string" },
|
|
98
|
+
"predicate_name": { "type": "string" },
|
|
99
|
+
"predicate_namespace": { "type": "string" },
|
|
100
|
+
"predicate_arity": { "type": "integer", "minimum": 1 },
|
|
101
|
+
"argument_names": { "type": "array", "items": { "type": "string" } },
|
|
102
|
+
"argument_types": { "type": "array", "items": { "type": "string" } },
|
|
103
|
+
"argument_descriptions": {
|
|
104
|
+
"type": "array",
|
|
105
|
+
"items": { "type": "string" }
|
|
106
|
+
},
|
|
107
|
+
"aliases": { "type": "array", "items": { "type": "string" } },
|
|
108
|
+
"examples": { "type": "array", "items": { "type": "string" } },
|
|
109
|
+
"predicate_args": { "type": "array", "items": { "type": "string" } }
|
|
88
110
|
},
|
|
89
111
|
"required": [
|
|
90
112
|
"id",
|
|
@@ -133,10 +155,65 @@
|
|
|
133
155
|
{ "required": ["closed_world"] },
|
|
134
156
|
{ "required": ["valid_from"] },
|
|
135
157
|
{ "required": ["valid_to"] },
|
|
136
|
-
{ "required": ["canonical_key"] }
|
|
158
|
+
{ "required": ["canonical_key"] },
|
|
159
|
+
{ "required": ["predicate_name"] },
|
|
160
|
+
{ "required": ["predicate_namespace"] },
|
|
161
|
+
{ "required": ["predicate_arity"] },
|
|
162
|
+
{ "required": ["argument_names"] },
|
|
163
|
+
{ "required": ["argument_types"] },
|
|
164
|
+
{ "required": ["argument_descriptions"] },
|
|
165
|
+
{ "required": ["aliases"] },
|
|
166
|
+
{ "required": ["examples"] },
|
|
167
|
+
{ "required": ["predicate_args"] }
|
|
137
168
|
]
|
|
138
169
|
}
|
|
139
170
|
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"if": {
|
|
174
|
+
"properties": {
|
|
175
|
+
"type": { "const": "fact" },
|
|
176
|
+
"fact_kind": { "const": "predicate_schema" }
|
|
177
|
+
},
|
|
178
|
+
"required": ["type", "fact_kind"]
|
|
179
|
+
},
|
|
180
|
+
"then": {
|
|
181
|
+
"required": [
|
|
182
|
+
"predicate_name",
|
|
183
|
+
"predicate_arity",
|
|
184
|
+
"argument_names",
|
|
185
|
+
"argument_types"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"if": {
|
|
191
|
+
"properties": {
|
|
192
|
+
"type": { "const": "fact" },
|
|
193
|
+
"fact_kind": { "const": "predicate" }
|
|
194
|
+
},
|
|
195
|
+
"required": ["type", "fact_kind"]
|
|
196
|
+
},
|
|
197
|
+
"then": {
|
|
198
|
+
"required": ["predicate_name", "predicate_args", "canonical_key"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"polarity": { "enum": ["assert", "deny"] }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"if": {
|
|
206
|
+
"properties": {
|
|
207
|
+
"type": { "const": "fact" },
|
|
208
|
+
"fact_kind": { "const": "property_value" }
|
|
209
|
+
},
|
|
210
|
+
"required": ["type", "fact_kind"]
|
|
211
|
+
},
|
|
212
|
+
"then": {
|
|
213
|
+
"properties": {
|
|
214
|
+
"polarity": { "enum": ["require", "forbid"] }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
140
217
|
}
|
|
141
218
|
],
|
|
142
219
|
"additionalProperties": false
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface BaseEntity {
|
|
|
13
13
|
text_ref?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface FactFields {
|
|
16
|
-
fact_kind?: "subject" | "property_value" | "observation" | "meta";
|
|
16
|
+
fact_kind?: "subject" | "property_value" | "observation" | "meta" | "predicate_schema" | "predicate";
|
|
17
17
|
subject_key?: string;
|
|
18
18
|
property_key?: string;
|
|
19
19
|
operator?: "eq" | "neq" | "lt" | "lte" | "gt" | "gte";
|
|
@@ -24,11 +24,20 @@ export interface FactFields {
|
|
|
24
24
|
value_bool?: boolean;
|
|
25
25
|
unit?: string;
|
|
26
26
|
scope?: string;
|
|
27
|
-
polarity?: "require" | "forbid";
|
|
27
|
+
polarity?: "require" | "forbid" | "assert" | "deny";
|
|
28
28
|
closed_world?: boolean;
|
|
29
29
|
valid_from?: string;
|
|
30
30
|
valid_to?: string;
|
|
31
31
|
canonical_key?: string;
|
|
32
|
+
predicate_name?: string;
|
|
33
|
+
predicate_namespace?: string;
|
|
34
|
+
predicate_arity?: number;
|
|
35
|
+
argument_names?: string[];
|
|
36
|
+
argument_types?: string[];
|
|
37
|
+
argument_descriptions?: string[];
|
|
38
|
+
aliases?: string[];
|
|
39
|
+
examples?: string[];
|
|
40
|
+
predicate_args?: string[];
|
|
32
41
|
}
|
|
33
42
|
export type Requirement = BaseEntity & {
|
|
34
43
|
type: "req";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/types/entities.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/types/entities.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EACN,SAAS,GACT,gBAAgB,GAChB,aAAa,GACb,MAAM,GACN,kBAAkB,GAClB,WAAW,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;IACtD,UAAU,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACpD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AACvD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AACzD,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACvD,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAC/C,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACjD,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AACrD,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,MAAM,GACd,WAAW,GACX,QAAQ,GACR,UAAU,GACV,GAAG,GACH,IAAI,GACJ,KAAK,GACL,MAAM,GACN,IAAI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface BaseRelationship {
|
|
2
|
-
type: "depends_on" | "specified_by" | "verified_by" | "implements" | "covered_by" | "constrained_by" | "constrains" | "requires_property" | "guards" | "publishes" | "consumes" | "supersedes" | "relates_to";
|
|
2
|
+
type: "depends_on" | "specified_by" | "verified_by" | "implements" | "covered_by" | "constrained_by" | "constrains" | "requires_property" | "requires_predicate" | "guards" | "publishes" | "consumes" | "supersedes" | "relates_to";
|
|
3
3
|
from: string;
|
|
4
4
|
to: string;
|
|
5
5
|
created_at?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/types/relationships.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,YAAY,GACZ,cAAc,GACd,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"relationships.d.ts","sourceRoot":"","sources":["../../src/types/relationships.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EACA,YAAY,GACZ,cAAc,GACd,aAAa,GACb,YAAY,GACZ,YAAY,GACZ,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,oBAAoB,GACpB,QAAQ,GACR,WAAW,GACX,UAAU,GACV,YAAY,GACZ,YAAY,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kibi-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kibi CLI for knowledge base management",
|
|
6
6
|
"engines": {
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"fast-glob": "^3.2.12",
|
|
96
96
|
"gray-matter": "^4.0.3",
|
|
97
97
|
"js-yaml": "^4.1.0",
|
|
98
|
-
"kibi-core": "^0.
|
|
98
|
+
"kibi-core": "^0.6.0",
|
|
99
99
|
"ts-morph": "^23.0.0",
|
|
100
100
|
"ignore": "^5.3.0"
|
|
101
101
|
},
|
|
@@ -17,12 +17,67 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
// Typed fact field enums per proposal
|
|
20
|
-
type FactKind =
|
|
20
|
+
type FactKind =
|
|
21
|
+
| "subject"
|
|
22
|
+
| "property_value"
|
|
23
|
+
| "observation"
|
|
24
|
+
| "meta"
|
|
25
|
+
| "predicate_schema"
|
|
26
|
+
| "predicate";
|
|
21
27
|
type Operator = "eq" | "neq" | "lt" | "lte" | "gt" | "gte";
|
|
22
28
|
type ValueType = "string" | "int" | "number" | "bool";
|
|
23
|
-
type Polarity = "require" | "forbid";
|
|
29
|
+
type Polarity = "require" | "forbid" | "assert" | "deny";
|
|
24
30
|
|
|
25
|
-
const
|
|
31
|
+
const factConditionals = JSON.parse(`[
|
|
32
|
+
{
|
|
33
|
+
"if": {
|
|
34
|
+
"properties": {
|
|
35
|
+
"type": { "const": "fact" },
|
|
36
|
+
"fact_kind": { "const": "predicate_schema" }
|
|
37
|
+
},
|
|
38
|
+
"required": ["type", "fact_kind"]
|
|
39
|
+
},
|
|
40
|
+
"then": {
|
|
41
|
+
"required": [
|
|
42
|
+
"predicate_name",
|
|
43
|
+
"predicate_arity",
|
|
44
|
+
"argument_names",
|
|
45
|
+
"argument_types"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"if": {
|
|
51
|
+
"properties": {
|
|
52
|
+
"type": { "const": "fact" },
|
|
53
|
+
"fact_kind": { "const": "predicate" }
|
|
54
|
+
},
|
|
55
|
+
"required": ["type", "fact_kind"]
|
|
56
|
+
},
|
|
57
|
+
"then": {
|
|
58
|
+
"required": ["predicate_name", "predicate_args", "canonical_key"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"polarity": { "enum": ["assert", "deny"] }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"if": {
|
|
66
|
+
"properties": {
|
|
67
|
+
"type": { "const": "fact" },
|
|
68
|
+
"fact_kind": { "const": "property_value" }
|
|
69
|
+
},
|
|
70
|
+
"required": ["type", "fact_kind"]
|
|
71
|
+
},
|
|
72
|
+
"then": {
|
|
73
|
+
"properties": {
|
|
74
|
+
"polarity": { "enum": ["require", "forbid"] }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]`) as Array<Record<string, unknown>>;
|
|
79
|
+
|
|
80
|
+
const entitySchema: Record<string, unknown> = {
|
|
26
81
|
$id: "entity.schema.json",
|
|
27
82
|
title: "Entity",
|
|
28
83
|
type: "object",
|
|
@@ -79,7 +134,14 @@ const entitySchema = {
|
|
|
79
134
|
// Typed fact fields - only valid when type === "fact"
|
|
80
135
|
fact_kind: {
|
|
81
136
|
type: "string",
|
|
82
|
-
enum: [
|
|
137
|
+
enum: [
|
|
138
|
+
"subject",
|
|
139
|
+
"property_value",
|
|
140
|
+
"observation",
|
|
141
|
+
"meta",
|
|
142
|
+
"predicate_schema",
|
|
143
|
+
"predicate",
|
|
144
|
+
] satisfies FactKind[],
|
|
83
145
|
},
|
|
84
146
|
subject_key: { type: "string" },
|
|
85
147
|
property_key: { type: "string" },
|
|
@@ -91,11 +153,23 @@ const entitySchema = {
|
|
|
91
153
|
value_bool: { type: "boolean" },
|
|
92
154
|
unit: { type: "string" },
|
|
93
155
|
scope: { type: "string" },
|
|
94
|
-
polarity: {
|
|
156
|
+
polarity: {
|
|
157
|
+
type: "string",
|
|
158
|
+
enum: ["require", "forbid", "assert", "deny"] satisfies Polarity[],
|
|
159
|
+
},
|
|
95
160
|
closed_world: { type: "boolean" },
|
|
96
161
|
valid_from: { type: "string" },
|
|
97
162
|
valid_to: { type: "string" },
|
|
98
163
|
canonical_key: { type: "string" },
|
|
164
|
+
predicate_name: { type: "string" },
|
|
165
|
+
predicate_namespace: { type: "string" },
|
|
166
|
+
predicate_arity: { type: "integer", minimum: 1 },
|
|
167
|
+
argument_names: { type: "array", items: { type: "string" } },
|
|
168
|
+
argument_types: { type: "array", items: { type: "string" } },
|
|
169
|
+
argument_descriptions: { type: "array", items: { type: "string" } },
|
|
170
|
+
aliases: { type: "array", items: { type: "string" } },
|
|
171
|
+
examples: { type: "array", items: { type: "string" } },
|
|
172
|
+
predicate_args: { type: "array", items: { type: "string" } },
|
|
99
173
|
},
|
|
100
174
|
required: [
|
|
101
175
|
"id",
|
|
@@ -133,10 +207,20 @@ const entitySchema = {
|
|
|
133
207
|
{ required: ["valid_from"] },
|
|
134
208
|
{ required: ["valid_to"] },
|
|
135
209
|
{ required: ["canonical_key"] },
|
|
210
|
+
{ required: ["predicate_name"] },
|
|
211
|
+
{ required: ["predicate_namespace"] },
|
|
212
|
+
{ required: ["predicate_arity"] },
|
|
213
|
+
{ required: ["argument_names"] },
|
|
214
|
+
{ required: ["argument_types"] },
|
|
215
|
+
{ required: ["argument_descriptions"] },
|
|
216
|
+
{ required: ["aliases"] },
|
|
217
|
+
{ required: ["examples"] },
|
|
218
|
+
{ required: ["predicate_args"] },
|
|
136
219
|
],
|
|
137
220
|
},
|
|
138
221
|
},
|
|
139
222
|
},
|
|
223
|
+
...factConditionals,
|
|
140
224
|
],
|
|
141
225
|
additionalProperties: false,
|
|
142
226
|
};
|
|
@@ -62,7 +62,14 @@
|
|
|
62
62
|
},
|
|
63
63
|
"fact_kind": {
|
|
64
64
|
"type": "string",
|
|
65
|
-
"enum": [
|
|
65
|
+
"enum": [
|
|
66
|
+
"subject",
|
|
67
|
+
"property_value",
|
|
68
|
+
"observation",
|
|
69
|
+
"meta",
|
|
70
|
+
"predicate_schema",
|
|
71
|
+
"predicate"
|
|
72
|
+
]
|
|
66
73
|
},
|
|
67
74
|
"subject_key": { "type": "string" },
|
|
68
75
|
"property_key": { "type": "string" },
|
|
@@ -80,11 +87,26 @@
|
|
|
80
87
|
"value_bool": { "type": "boolean" },
|
|
81
88
|
"unit": { "type": "string" },
|
|
82
89
|
"scope": { "type": "string" },
|
|
83
|
-
"polarity": {
|
|
90
|
+
"polarity": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"enum": ["require", "forbid", "assert", "deny"]
|
|
93
|
+
},
|
|
84
94
|
"closed_world": { "type": "boolean" },
|
|
85
95
|
"valid_from": { "type": "string" },
|
|
86
96
|
"valid_to": { "type": "string" },
|
|
87
|
-
"canonical_key": { "type": "string" }
|
|
97
|
+
"canonical_key": { "type": "string" },
|
|
98
|
+
"predicate_name": { "type": "string" },
|
|
99
|
+
"predicate_namespace": { "type": "string" },
|
|
100
|
+
"predicate_arity": { "type": "integer", "minimum": 1 },
|
|
101
|
+
"argument_names": { "type": "array", "items": { "type": "string" } },
|
|
102
|
+
"argument_types": { "type": "array", "items": { "type": "string" } },
|
|
103
|
+
"argument_descriptions": {
|
|
104
|
+
"type": "array",
|
|
105
|
+
"items": { "type": "string" }
|
|
106
|
+
},
|
|
107
|
+
"aliases": { "type": "array", "items": { "type": "string" } },
|
|
108
|
+
"examples": { "type": "array", "items": { "type": "string" } },
|
|
109
|
+
"predicate_args": { "type": "array", "items": { "type": "string" } }
|
|
88
110
|
},
|
|
89
111
|
"required": [
|
|
90
112
|
"id",
|
|
@@ -133,10 +155,65 @@
|
|
|
133
155
|
{ "required": ["closed_world"] },
|
|
134
156
|
{ "required": ["valid_from"] },
|
|
135
157
|
{ "required": ["valid_to"] },
|
|
136
|
-
{ "required": ["canonical_key"] }
|
|
158
|
+
{ "required": ["canonical_key"] },
|
|
159
|
+
{ "required": ["predicate_name"] },
|
|
160
|
+
{ "required": ["predicate_namespace"] },
|
|
161
|
+
{ "required": ["predicate_arity"] },
|
|
162
|
+
{ "required": ["argument_names"] },
|
|
163
|
+
{ "required": ["argument_types"] },
|
|
164
|
+
{ "required": ["argument_descriptions"] },
|
|
165
|
+
{ "required": ["aliases"] },
|
|
166
|
+
{ "required": ["examples"] },
|
|
167
|
+
{ "required": ["predicate_args"] }
|
|
137
168
|
]
|
|
138
169
|
}
|
|
139
170
|
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"if": {
|
|
174
|
+
"properties": {
|
|
175
|
+
"type": { "const": "fact" },
|
|
176
|
+
"fact_kind": { "const": "predicate_schema" }
|
|
177
|
+
},
|
|
178
|
+
"required": ["type", "fact_kind"]
|
|
179
|
+
},
|
|
180
|
+
"then": {
|
|
181
|
+
"required": [
|
|
182
|
+
"predicate_name",
|
|
183
|
+
"predicate_arity",
|
|
184
|
+
"argument_names",
|
|
185
|
+
"argument_types"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"if": {
|
|
191
|
+
"properties": {
|
|
192
|
+
"type": { "const": "fact" },
|
|
193
|
+
"fact_kind": { "const": "predicate" }
|
|
194
|
+
},
|
|
195
|
+
"required": ["type", "fact_kind"]
|
|
196
|
+
},
|
|
197
|
+
"then": {
|
|
198
|
+
"required": ["predicate_name", "predicate_args", "canonical_key"],
|
|
199
|
+
"properties": {
|
|
200
|
+
"polarity": { "enum": ["assert", "deny"] }
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"if": {
|
|
206
|
+
"properties": {
|
|
207
|
+
"type": { "const": "fact" },
|
|
208
|
+
"fact_kind": { "const": "property_value" }
|
|
209
|
+
},
|
|
210
|
+
"required": ["type", "fact_kind"]
|
|
211
|
+
},
|
|
212
|
+
"then": {
|
|
213
|
+
"properties": {
|
|
214
|
+
"polarity": { "enum": ["require", "forbid"] }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
140
217
|
}
|
|
141
218
|
],
|
|
142
219
|
"additionalProperties": false
|