@aikdna/kdna-core 0.2.1 → 0.2.3

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 ADDED
@@ -0,0 +1,49 @@
1
+ # @aikdna/kdna-core
2
+
3
+ Pure logic library (zero dependencies) for loading, validating, linting, rendering, and composing KDNA domain cognition packages.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @aikdna/kdna-core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ const { lintDomain, validateDomainSchema, validateCrossFile, renderDomain } = require('@aikdna/kdna-core');
15
+
16
+ // Validate a domain
17
+ const dataMap = {
18
+ 'KDNA_Core.json': { meta: { domain: 'my_domain' }, axioms: [...] },
19
+ 'KDNA_Patterns.json': { meta: { domain: 'my_domain' }, self_check: [...] }
20
+ };
21
+
22
+ const lintResult = lintDomain(dataMap);
23
+ const schemaResult = validateDomainSchema(dataMap, schemas);
24
+ const crossResult = validateCrossFile(dataMap);
25
+ ```
26
+
27
+ ## API
28
+
29
+ ### `lintDomain(dataMap)`
30
+ Structural linting — checks required files, field presence, unique IDs, yes/no answerable self-checks, cross-file references, and flags potentially vague axioms.
31
+
32
+ Returns `{ errors: string[], warnings: string[] }`.
33
+
34
+ ### `validateDomainSchema(dataMap, schemaMap)`
35
+ JSON Schema validation against published schemas (KDNA_Core, KDNA_Patterns, KDNA_Scenarios, KDNA_Cases, KDNA_Reasoning, KDNA_Evolution).
36
+
37
+ Returns `{ errors: string[], warnings: string[] }`.
38
+
39
+ ### `validateCrossFile(dataMap)`
40
+ Cross-file consistency checks — ensures references between domain files are valid.
41
+
42
+ Returns `{ errors: string[], warnings: string[] }`.
43
+
44
+ ### `renderDomain(dataMap, options?)`
45
+ Renders domain files into a structured context block using a standard template. The rendered context preserves the domain's structure as distinct, named sections suitable for agent system prompts.
46
+
47
+ ## License
48
+
49
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-core",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "KDNA core library — pure logic for loading, validating, linting, and rendering KDNA domain cognition packages. Zero Node.js dependencies.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -17,7 +17,8 @@
17
17
  "types": "src/types.d.ts",
18
18
  "files": [
19
19
  "src/",
20
- "schema/"
20
+ "schema/",
21
+ "README.md"
21
22
  ],
22
23
  "keywords": [
23
24
  "kdna",
@@ -38,7 +39,11 @@
38
39
  "ajv-formats": "^3.0.1"
39
40
  },
40
41
  "peerDependenciesMeta": {
41
- "ajv": { "optional": true },
42
- "ajv-formats": { "optional": true }
42
+ "ajv": {
43
+ "optional": true
44
+ },
45
+ "ajv-formats": {
46
+ "optional": true
47
+ }
43
48
  }
44
49
  }
package/src/lint-pure.js CHANGED
@@ -57,7 +57,7 @@ function lintDomain(dataMap) {
57
57
  cn.endsWith('?') ||
58
58
  cn.endsWith('吗') ||
59
59
  cn.includes('是否') ||
60
- /^(have|has|can|does|do|is|are|能不能|会不会|有没有|要不要|是不是)/.test(t)
60
+ /^(have|has|can|does|do|is|are|did|was|were|should|will|would|could|might|能不能|会不会|有没有|要不要|是不是)/.test(t)
61
61
  )
62
62
  return;
63
63
  warnings.push(