@aikdna/kdna-cli 0.16.10 → 0.18.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/README.md CHANGED
@@ -1,10 +1,20 @@
1
1
  # @aikdna/kdna-cli
2
2
 
3
- **KDNA CLI is the runtime control plane for loading, validating, composing, testing, and governing domain judgment for AI agents.**
3
+ > **KDNA Ecosystem:** [`kdna`](https://github.com/aikdna/kdna) the protocol. [KDNAChat](https://github.com/AhaSparkCoach/kdnachat) the consumption client. [KDNaStudio](https://github.com/AhaSparkCoach/kdnastudio) the authoring tool. [KDNAWork](https://github.com/AhaSparkCoach/kdnawork) the workbench. **You are here → kdna-cli** — the toolchain. [Registry](https://github.com/aikdna/kdna-registry) — the catalog.
4
4
 
5
- KDNA CLI AI Agent 加载、验证、组合、测试和治理领域判断的运行控制平面。
5
+ **Role**: kdna-cli is the **runtime control plane** — the official reference implementation for domain validation, loading, packaging, comparison, and agent-facing runtime workflows. It bridges Studio output to Chat/Work consumption.
6
6
 
7
- Part of the [KDNA](https://github.com/aikdna/KDNA) ecosystem.
7
+ **KDNA CLI is the official open-source reference implementation for KDNA validation, loading, packaging, comparison, registry access, and agent-facing runtime workflows.**
8
+
9
+ It is the runtime control plane for loading, validating, composing, testing, and governing domain judgment for AI agents.
10
+
11
+ KDNA CLI 是 KDNA 验证、加载、打包、比较、注册表访问和 Agent 运行时工作流的官方开源参考实现,也是 AI Agent 加载、验证、组合、测试和治理领域判断的运行控制平面。
12
+
13
+ The CLI is how a KDNA domain judgment package becomes usable by agents. It installs KDNA domains, verifies their structure and trust metadata, loads them into agent-readable form, compares judgment paths with and without KDNA, and records traces for audit.
14
+
15
+ KDNA CLI 让一个领域判断资产真正被 Agent 使用。它负责安装 KDNA、验证结构与信任信息、把 KDNA 转换成 Agent 可加载的形式、对比加载前后的判断路径,并记录可审计的使用痕迹。
16
+
17
+ Part of the [KDNA](https://github.com/aikdna/kdna) ecosystem.
8
18
 
9
19
  ## Install
10
20
 
@@ -24,103 +34,176 @@ kdna compare @aikdna/writing --input "help me improve this post"
24
34
  kdna doctor --agents
25
35
  ```
26
36
 
27
- ## Commands by Role
37
+ ## The 6 Commands You Actually Need
38
+
39
+ | Command | What it does |
40
+ |---------|-------------|
41
+ | `kdna setup` | Initialize ~/.kdna, install the agent skill loader |
42
+ | `kdna install <domain>` | Install a domain from the registry |
43
+ | `kdna list` | Show installed domains with quality info |
44
+ | `kdna verify <domain>` | 3-layer check: structure + trust + judgment |
45
+ | `kdna compare <domain> --input "..."` | Compare with/without KDNA judgment |
46
+ | `kdna doctor --agents` | Check agent integration health |
47
+
48
+ ## All Commands by Role
28
49
 
29
50
  ### Domain Authoring
30
51
 
31
- | Command | Description |
32
- |---------|-------------|
33
- | `kdna init <name>` | Scaffold a new domain from template |
34
- | `kdna validate <path>` | Validate domain structure |
35
- | `kdna validate --schema <path>` | Schema-only validation |
36
- | `kdna pack <path>` | Pack into .kdna container |
37
- | `kdna pack <path> --encrypt --license <file>` | Pack encrypted .kdnae container |
38
- | `kdna unpack <file>` | Unpack .kdna or .kdnae container |
39
- | `kdna inspect <path>` | Inspect domain or .kdna file |
40
- | `kdna publish <path>` | Pack + sign + publish to registry |
41
- | `kdna publish --check <path>` | Quality gate check only |
42
- | `kdna version bump <level> [path]` | Bump domain version |
52
+ | Command | Status | Description |
53
+ |---------|--------|-------------|
54
+ | `kdna init <name>` | Beta | Scaffold a new domain from template |
55
+ | `kdna dev validate <path>` | Stable | Validate a non-canonical dev source directory |
56
+ | `kdna dev pack <path>` | Beta | Build a dev source directory into a .kdna asset |
57
+ | `kdna dev unpack <file>` | Beta | Unpack .kdna into a dev source directory |
58
+ | `kdna dev inspect <path>` | Beta | Inspect a non-canonical dev source directory |
59
+ | `kdna dev card <path>` | Beta | Display KDNA Card from a dev source directory |
60
+ | `kdna inspect <file.kdna>` | Beta | Inspect a .kdna asset |
61
+ | `kdna publish <path>` | Experimental | Pack + sign + publish to registry |
62
+ | `kdna publish --check <path>` | Experimental | Quality gate check only |
63
+ | `kdna version bump <level> [path]` | Beta | Bump domain version |
43
64
 
44
65
  ### Agent Runtime
45
66
 
46
- | Command | Description |
47
- |---------|-------------|
48
- | `kdna available [--json]` | List installed domains with v2.1 fields |
49
- | `kdna match "<task>" [--json]` | Signal matching — find relevant domains |
50
- | `kdna load <name> [--as=prompt\|json\|raw]` | Emit domain in agent-ready format |
51
- | `kdna postvalidate <name> --output <file>` | Post-generation judgment check |
67
+ | Command | Status | Description |
68
+ |---------|--------|-------------|
69
+ | `kdna available [--json]` | Beta | List installed domains with v2.1 fields |
70
+ | `kdna match "<task>" [--json]` | Beta | Signal matching — find relevant domains |
71
+ | `kdna load <name\|file.kdna> [--as=prompt\|json\|raw]` | Beta | Emit asset in agent-ready format |
72
+ | `kdna postvalidate <name> --output <file>` | Beta | Post-generation judgment check |
52
73
 
53
74
  ### Testing & Verification
54
75
 
55
- | Command | Description |
56
- |---------|-------------|
57
- | `kdna verify <name>` | 3-layer: structure + trust + judgment |
58
- | `kdna compare <name> --input "..."` | With/without KDNA reasoning diff |
59
- | `kdna compare <name> --input "..." --report-md` | Markdown report with scoring |
60
- | `kdna compare <name> --input "..." --report-json` | JSON report with scoring |
61
- | `kdna diff <name>@<v1> <name>@<v2>` | Judgment-level diff between versions |
76
+ | Command | Status | Description |
77
+ |---------|--------|-------------|
78
+ | `kdna verify <name\|file.kdna>` | Beta | 3-layer: structure + trust + judgment |
79
+ | `kdna compare <name\|file.kdna> --input "..."` | Beta | With/without KDNA reasoning diff |
80
+ | `kdna compare <name\|file.kdna> --input "..." --report-md` | Beta | Markdown report with scoring |
81
+ | `kdna compare <name\|file.kdna> --input "..." --report-json` | Beta | JSON report with scoring |
82
+ | `kdna diff <name>@<v1> <name>@<v2>` | Beta | Judgment-level diff between versions |
62
83
 
63
84
  ### Diagnostics & Trace
64
85
 
65
- | Command | Description |
66
- |---------|-------------|
67
- | `kdna doctor` | System health check |
68
- | `kdna doctor --agents` | Agent integration check (Codex/Claude/OpenCode/Cursor/Gemini) |
69
- | `kdna doctor --json` | Machine-readable health report |
70
- | `kdna trace` | View recent load/postvalidate traces |
71
- | `kdna trace --json` | Machine-readable trace output |
72
- | `kdna trace --export <file>` | Export traces for audit |
73
- | `kdna trace --since 7d\|30d\|90d` | Filter by time range |
74
- | `kdna history` | Recent domain usage (last 20) |
75
- | `kdna history --stats` | Aggregate by domain and agent |
76
- | `kdna history --domain <name>` | Filter by domain |
86
+ | Command | Status | Description |
87
+ |---------|--------|-------------|
88
+ | `kdna doctor` | Beta | System health check |
89
+ | `kdna doctor --agents` | Beta | Agent integration check (Codex/Claude/OpenCode/Cursor/Gemini) |
90
+ | `kdna doctor --json` | Beta | Machine-readable health report |
91
+ | `kdna trace` | Experimental | View recent load/postvalidate traces |
92
+ | `kdna trace --json` | Experimental | Machine-readable trace output |
93
+ | `kdna trace --export <file>` | Experimental | Export traces for audit |
94
+ | `kdna trace --since 7d\|30d\|90d` | Experimental | Filter by time range |
95
+ | `kdna history` | Experimental | Recent domain usage (last 20) |
96
+ | `kdna history --stats` | Experimental | Aggregate by domain and agent |
97
+ | `kdna history --domain <name>` | Experimental | Filter by domain |
77
98
 
78
99
  ### License & Authorization
79
100
 
80
- | Command | Description |
81
- |---------|-------------|
82
- | `kdna license generate <domain> --to <email>` | Generate signed license |
83
- | `kdna license install <license.json>` | Register license for auto-decrypt |
84
- | `kdna license verify <license.json>` | Verify license signature and validity |
85
- | `kdna license bind <license.json>` | Bind license to this machine |
86
- | `kdna license show <license.json>` | Display license details |
101
+ | Command | Status | Description |
102
+ |---------|--------|-------------|
103
+ | `kdna license generate <domain> --to <email>` | Experimental | Generate signed license |
104
+ | `kdna license install <license.json>` | Experimental | Register license for auto-decrypt |
105
+ | `kdna license activate <domain> --key <key> --server <url>` | Experimental | Activate a license from entitlement source |
106
+ | `kdna license sync [domain] [--server <url>]` | Experimental | Refresh entitlement and revocation status |
107
+ | `kdna license verify <license.json>` | Experimental | Verify license signature and validity |
108
+ | `kdna license bind <license.json>` | Experimental | Bind license to this machine |
109
+ | `kdna license show <license.json>` | Experimental | Display license details |
110
+ | `kdna license status [domain] [--json]` | Experimental | Show installed license activation status without exposing keys |
87
111
 
88
112
  ### Cluster Composition
89
113
 
90
- | Command | Description |
91
- |---------|-------------|
92
- | `kdna cluster lint <path>` | Validate cluster manifest |
114
+ | Command | Status | Description |
115
+ |---------|--------|-------------|
116
+ | `kdna cluster lint <path>` | Planned | Validate cluster manifest |
93
117
 
94
118
  ### Registry & Distribution
95
119
 
96
- | Command | Description |
97
- |---------|-------------|
98
- | `kdna install <name>` | Install domain from registry |
99
- | `kdna install ./file.kdna` | Install from local .kdna file |
100
- | `kdna install ./file.kdnae` | Install from encrypted .kdnae (auto-decrypt with license) |
101
- | `kdna remove <name>` | Uninstall a domain |
102
- | `kdna update <name>` | Update installed domain |
103
- | `kdna info <name>` | Show domain metadata and trust status |
104
- | `kdna list [--available]` | List installed or available domains |
105
- | `kdna search <keyword>` | Search registry |
106
- | `kdna registry refresh` | Refresh registry cache |
120
+ | Command | Status | Description |
121
+ |---------|--------|-------------|
122
+ | `kdna install <name>` | Beta | Install domain from registry |
123
+ | `kdna install file.kdna` | Beta | Install from local .kdna asset |
124
+ | `kdna remove <name>` | Beta | Uninstall a domain |
125
+ | `kdna update <name>` | Beta | Update installed domain |
126
+ | `kdna info <name>` | Beta | Show domain metadata and trust status |
127
+ | `kdna list [--available]` | Beta | List installed or available domains |
128
+ | `kdna search <keyword>` | Beta | Search registry |
129
+ | `kdna registry refresh` | Beta | Refresh registry cache |
107
130
 
108
131
  ### Identity & Signing
109
132
 
110
- | Command | Description |
111
- |---------|-------------|
112
- | `kdna identity init` | Generate Ed25519 signing key |
113
- | `kdna identity show` | Display public key and buyer ID |
114
- | `kdna identity export [--out]` | Backup private key (encrypted) |
115
- | `kdna identity import <file>` | Restore identity from backup |
133
+ | Command | Status | Description |
134
+ |---------|--------|-------------|
135
+ | `kdna identity init` | Experimental | Generate Ed25519 signing key |
136
+ | `kdna identity show` | Experimental | Display public key and buyer ID |
137
+ | `kdna identity export [--out]` | Experimental | Backup private key (encrypted) |
138
+ | `kdna identity import <file>` | Experimental | Restore identity from backup |
116
139
 
117
140
  ### Setup
118
141
 
119
- | Command | Description |
120
- |---------|-------------|
121
- | `kdna setup` | One-command setup: CLI + skill + data root |
142
+ | Command | Status | Description |
143
+ |---------|--------|-------------|
144
+ | `kdna setup` | Beta | One-command setup: CLI + skill + data root |
145
+
146
+ ---
147
+
148
+ ## SPEC Compatibility
149
+
150
+ KDNA CLI follows the canonical KDNA asset structure defined in [`aikdna/kdna`](https://github.com/aikdna/kdna).
151
+
152
+ A valid KDNA domain is a `.kdna` asset. The internal tree of that asset may include up to six standard KDNA judgment files:
153
+
154
+ - `KDNA_Core.json`
155
+ - `KDNA_Patterns.json`
156
+ - `KDNA_Scenarios.json`
157
+ - `KDNA_Cases.json`
158
+ - `KDNA_Reasoning.json`
159
+ - `KDNA_Evolution.json`
160
+
161
+ The minimum valid `.kdna` asset requires these internal entries:
162
+
163
+ - `KDNA_Core.json`
164
+ - `KDNA_Patterns.json`
165
+
166
+ Each KDNA judgment file must include `meta.version`, `meta.domain`, `meta.created`, `meta.purpose`, and `meta.load_condition`.
167
+
168
+ Source directories are dev-only authoring workspaces. Public install, inspect, verify, load, compare, and agent-facing commands consume `.kdna` assets or installed asset names, not source directories.
169
+
170
+ ---
171
+
172
+ ## Default Registry
173
+
174
+ By default, KDNA CLI uses the official KDNA registry. Registry schema v3 is asset-first: installable entries must publish `asset_url`, `asset_digest`, signature metadata, trust snapshot/timestamp metadata, and revocations. Expired, yanked, revoked, or digest-mismatched assets are rejected. Users may override the registry with `KDNA_REGISTRY_URL`.
175
+
176
+ ```bash
177
+ # Use the official registry (default)
178
+ kdna install @aikdna/writing
179
+
180
+ # Use a custom registry
181
+ export KDNA_REGISTRY_URL="https://my-registry.example.com/domains.json"
182
+ kdna install @myorg/internal
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Open Source and Commercial Boundary
188
+
189
+ KDNA keeps the protocol, schemas, validator, core CLI, benchmark tools, and reference examples open source.
190
+
191
+ Commercial or hosted layers may include:
192
+
193
+ - Managed registry services
194
+ - Quality badge review workflows
195
+ - Hosted runtime guard
196
+ - Enterprise private registry
197
+ - Team collaboration in KDNA Studio
198
+ - Licensed/private judgment asset distribution
199
+
200
+ KDNA supports both open judgment assets and licensed/private judgment assets. Open assets remain the default path for community adoption. Licensed assets still use the `.kdna` extension; protected entries are decrypted only in memory after local license activation.
201
+
202
+ KDNA 同时支持开放判断资产和授权/私有判断资产。开放资产是社区采用的默认路径;授权资产仍然使用 `.kdna` 后缀,受保护条目只会在本地 license activation 通过后以内存方式解密。
203
+
204
+ ---
122
205
 
123
- ### Environment Variables
206
+ ## Environment Variables
124
207
 
125
208
  | Variable | Purpose |
126
209
  |----------|---------|
@@ -165,7 +248,7 @@ kdna license verify --json <file>
165
248
  | Authoring | KDNA Studio | Human-led judgment production |
166
249
  | Consumption | KDNAChat | Load, use, compare |
167
250
  | Governance | KDNA Governance Console | Approve, release, audit |
168
- | Distribution | Registry | Discover, install, trade |
251
+ | Distribution | Registry | Discover, install, license, distribute |
169
252
 
170
253
  ## Development
171
254
 
@@ -178,9 +261,9 @@ npm test
178
261
 
179
262
  ## Related
180
263
 
181
- - [@aikdna/kdna-core](https://github.com/aikdna/KDNA/tree/main/packages/kdna-core) — Pure logic library
264
+ - [@aikdna/kdna-core](https://github.com/aikdna/kdna/tree/main/packages/kdna-core) — Pure logic library
182
265
  - [KDNA Registry](https://github.com/aikdna/kdna-registry) — Domain catalog
183
- - [KDNA SPEC](https://github.com/aikdna/KDNA) — Protocol specification
266
+ - [KDNA SPEC](https://github.com/aikdna/kdna) — Protocol specification
184
267
  - [aikdna.com](https://aikdna.com) — Website
185
268
 
186
269
  ## License
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-cli",
3
- "version": "0.16.10",
4
- "description": "KDNA CLI — create, validate, install, and manage domain cognition packages for AI agents.",
3
+ "version": "0.18.0",
4
+ "description": "KDNA CLI — create, validate, install, and manage domain judgment packages for AI agents.",
5
5
  "type": "commonjs",
6
6
  "bin": {
7
7
  "kdna": "src/cli.js",
@@ -30,8 +30,8 @@
30
30
  "kdna",
31
31
  "kdna-cli",
32
32
  "ai-agent",
33
- "domain-cognition",
34
- "knowledge-dna",
33
+ "domain-judgment",
34
+ "judgment-protocol",
35
35
  "cli"
36
36
  ],
37
37
  "license": "Apache-2.0",
@@ -47,7 +47,7 @@
47
47
  "node": ">=18"
48
48
  },
49
49
  "dependencies": {
50
- "@aikdna/kdna-core": "^0.3.0"
50
+ "@aikdna/kdna-core": "^0.5.0"
51
51
  },
52
52
  "optionalDependencies": {
53
53
  "ajv": "^8.17.1",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kdna-loader
3
- description: Discover and load KDNA judgment frameworks from ~/.kdna/domains/ when the task requires domain-specific judgment (review, diagnosis, critique, classification, strategy) where the same input could legitimately be interpreted multiple ways. Skip for pure formatting, factual lookup, code execution, or mechanical transformations. This skill is the entire interface to KDNA — domains themselves are not separate skills.
3
+ description: Discover and load KDNA judgment frameworks from installed .kdna assets when the task requires domain-specific judgment (review, diagnosis, critique, classification, strategy) where the same input could legitimately be interpreted multiple ways. Skip for pure formatting, factual lookup, code execution, or mechanical transformations. This skill is the entire interface to KDNA — domains themselves are not separate skills.
4
4
  ---
5
5
 
6
6
  # KDNA Loader
@@ -17,7 +17,7 @@ this skill provides the **routing and protocol**, KDNA provides the
17
17
  **judgment material**.
18
18
 
19
19
  This skill is the **only** KDNA-related skill. Domains themselves are
20
- not registered as skills — they live in `~/.kdna/domains/` as data and
20
+ not registered as skills — they live as `.kdna` assets under `~/.kdna/packages/` and
21
21
  are discovered on demand. Whether the user has 1 domain installed or
22
22
  100, this skill is the single entry point.
23
23
 
@@ -68,8 +68,8 @@ Returns a compact JSON array — one entry per installed domain — with:
68
68
  axioms), `does_not_apply_when` (flattened), `failure_risks`. Yanked
69
69
  domains are excluded automatically.
70
70
 
71
- This is your **only** discovery interface. Do not `ls ~/.kdna/domains/`
72
- or `cat` the JSON files directly — the CLI is the supported contract
71
+ This is your **only** discovery interface. Do not inspect `~/.kdna/packages/` manually, unzip `.kdna` files,
72
+ or `cat` internal JSON entries directly — the CLI is the supported contract
73
73
  between this skill and the KDNA file format. The on-disk layout may
74
74
  change; `kdna available` will not.
75
75
 
@@ -291,8 +291,7 @@ Otherwise, stay silent about the loading mechanics.
291
291
 
292
292
  ## What this skill is NOT
293
293
 
294
- - Not a list of available KDNA domains (those live in
295
- `~/.kdna/domains/`, discovered on demand)
294
+ - Not a list of available KDNA domains (those are installed `.kdna` assets, discovered on demand)
296
295
  - Not a registry browser (use `kdna list --available` CLI)
297
296
  - Not a domain creator (use `kdna init <name>` CLI)
298
297
  - Not an auto-loader that runs on every request — you decide per