@aikdna/kdna-cli 0.25.0 → 0.25.1

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
@@ -2,203 +2,86 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@aikdna/kdna-cli)](https://www.npmjs.com/package/@aikdna/kdna-cli) [![CI](https://github.com/aikdna/kdna-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/aikdna/kdna-cli/actions/workflows/ci.yml) [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
4
4
 
5
- > **KDNA Core v1 is the official KDNA judgment-asset format and runtime loading contract.** `.kdna` assets are created, inspected, packed, unpacked, and validated through the **official KDNA toolchain**.
5
+ The official command-line runtime for KDNA Core v1 judgment assets.
6
6
 
7
- **Role**: kdna-cli is the **official KDNA runtime CLI** — the official command-line entry point of the KDNA toolchain for inspecting, validating, packing, unpacking, and loading `.kdna` assets.
7
+ KDNA CLI inspects, validates, packs, unpacks, and loads `.kdna` files. It is
8
+ the consumer/runtime side of the official KDNA toolchain. Formal authoring is
9
+ handled by KDNA Studio CLI and Studio Core.
8
10
 
9
- **KDNA CLI is the official CLI entry of the KDNA toolchain the official command-line surface for `.kdna` asset operations.**
10
-
11
- Third-party products integrate KDNA through the official SDK, CLI, Loader, or API.
12
-
13
- KDNA CLI 是 KDNA 官方工具链的 CLI 入口,是 `.kdna` 资产操作的官方命令行界面。第三方产品通过官方 SDK、CLI、Loader 或 API 接入 KDNA。
14
-
15
- The CLI is how a `.kdna` judgment asset becomes usable by agents. It inspects, validates, packs, unpacks, and loads KDNA assets, and records traces for audit.
16
-
17
- KDNA CLI 让一个领域判断资产真正被 Agent 使用。它负责安装 KDNA、验证结构与信任信息、把 KDNA 转换成 Agent 可加载的形式、对比加载前后的判断路径,并记录可审计的使用痕迹。
18
-
19
- A `.kdna` asset is not created by writing JSON files. It is compiled by a
20
- Studio-compatible authoring pipeline that performs human confirmation,
21
- validation, canonicalization, identity generation, digest computation, signing,
22
- optional encryption, and provenance recording. kdna-cli verifies and publishes
23
- existing assets; it does not author trusted KDNA.
24
-
25
- Part of the [KDNA](https://github.com/aikdna/kdna) ecosystem.
11
+ KDNA Core v1 does not require a public registry, marketplace, quality badge, or
12
+ signature system. The current first-run path uses local `.kdna` files.
26
13
 
27
14
  ## Install
28
15
 
29
16
  ```bash
30
17
  npm install -g @aikdna/kdna-cli
31
- kdna setup
32
18
  ```
33
19
 
34
- ## Quick Start (5 minutes)
20
+ ## 5-Minute Path
35
21
 
36
22
  ```bash
37
- npm install -g @aikdna/kdna-cli
38
- kdna setup
39
- kdna install @aikdna/writing
40
- kdna verify @aikdna/writing --judgment
41
- kdna compare @aikdna/writing --input "help me improve this post"
42
- kdna doctor --agents
23
+ kdna demo minimal ./minimal
24
+ kdna inspect ./minimal
25
+ kdna validate ./minimal
26
+ kdna pack ./minimal ./minimal.kdna
27
+ kdna validate ./minimal.kdna
28
+ kdna load ./minimal.kdna --profile=compact --as=prompt
43
29
  ```
44
30
 
45
- ## The 6 Commands You Actually Need
46
-
47
- | Command | What it does |
48
- | ------------------------------------- | -------------------------------------------------- |
49
- | `kdna setup` | Initialize ~/.kdna, install the agent skill loader |
50
- | `kdna install <domain>` | Install a domain from the registry |
51
- | `kdna list` | Show installed domains with quality info |
52
- | `kdna verify <domain>` | 3-layer check: structure + trust + judgment |
53
- | `kdna compare <domain> --input "..."` | Compare with/without KDNA judgment |
54
- | `kdna doctor --agents` | Check agent integration health |
55
-
56
- ## All Commands by Role
57
-
58
- ### Dev Source Utilities
59
-
60
- | Command | Status | Description |
61
- | ---------------------------------- | ------------ | --------------------------------------------------------------------------- |
62
- | `kdna init <name>` | Deprecated | Alias for `kdna dev scaffold`; creates a non-canonical dev source workspace |
63
- | `kdna dev scaffold <name>` | Beta | Scaffold a non-canonical dev source workspace |
64
- | `kdna dev validate <path>` | Stable | Validate a non-canonical dev source directory |
65
- | `kdna dev pack <path>` | Beta | Build a dev-only non-trusted `.kdna` bundle |
66
- | `kdna dev unpack <file>` | Beta | Unpack .kdna into a dev source directory |
67
- | `kdna dev inspect <path>` | Beta | Inspect a non-canonical dev source directory |
68
- | `kdna dev card <path>` | Beta | Display KDNA Card from a dev source directory |
69
- | `kdna inspect <file.kdna>` | Beta | Inspect a .kdna asset |
70
- | `kdna publish <file.kdna>` | Experimental | Publish an existing Studio-compiled `.kdna` asset |
71
- | `kdna publish --check <path>` | Experimental | Dev source readiness check only; does not publish |
72
- | `kdna version bump <level> [path]` | Beta | Bump domain version |
73
-
74
- ### Agent Runtime
75
-
76
- | Command | Status | Description |
77
- | ------------------------------------------------------ | ------ | --------------------------------------- |
78
- | `kdna available [--json]` | Beta | List installed domains with v2.1 fields |
79
- | `kdna match "<task>" [--json]` | Beta | Signal matching — find relevant domains |
80
- | `kdna load <name\|file.kdna> [--as=prompt\|json\|raw]` | Beta | Emit asset in agent-ready format |
81
- | `kdna postvalidate <name> --output <file>` | Beta | Post-generation judgment check |
82
-
83
- ### Testing & Verification
84
-
85
- | Command | Status | Description |
86
- | ------------------------------------------------------------ | ------ | ------------------------------------- |
87
- | `kdna verify <name\|file.kdna>` | Beta | 3-layer: structure + trust + judgment |
88
- | `kdna compare <name\|file.kdna> --input "..."` | Beta | With/without KDNA reasoning diff |
89
- | `kdna compare <name\|file.kdna> --input "..." --report-md` | Beta | Markdown report with scoring |
90
- | `kdna compare <name\|file.kdna> --input "..." --report-json` | Beta | JSON report with scoring |
91
- | `kdna diff <name>@<v1> <name>@<v2>` | Beta | Judgment-level diff between versions |
92
-
93
- ### Diagnostics & Trace
94
-
95
- | Command | Status | Description |
96
- | --------------------------------- | ------------ | ------------------------------------------------------------- |
97
- | `kdna doctor` | Beta | System health check |
98
- | `kdna doctor --agents` | Beta | Agent integration check (Codex/Claude/OpenCode/Cursor/Gemini) |
99
- | `kdna doctor --json` | Beta | Machine-readable health report |
100
- | `kdna trace` | Experimental | View recent load/postvalidate traces |
101
- | `kdna trace --json` | Experimental | Machine-readable trace output |
102
- | `kdna trace --export <file>` | Experimental | Export traces for audit |
103
- | `kdna trace --since 7d\|30d\|90d` | Experimental | Filter by time range |
104
- | `kdna history` | Experimental | Recent domain usage (last 20) |
105
- | `kdna history --stats` | Experimental | Aggregate by domain and agent |
106
- | `kdna history --domain <name>` | Experimental | Filter by domain |
107
-
108
- ### License & Authorization
109
-
110
- Licensed asset loading (`kdna install`, `kdna load`, `kdna verify`) requires a
111
- valid local activation. Full RFC-0008 conformance across JS Core, Swift Core,
112
- and CLI is tracked via cross-language test vectors in the
113
- [kdna](https://github.com/aikdna/kdna) conformance suite.
114
-
115
- | Command | Status | Description |
116
- | ----------------------------------------------------------- | ------------ | -------------------------------------------------------------- |
117
- | `kdna license generate <domain> --to <email>` | Experimental | Generate signed license |
118
- | `kdna license install <license.json>` | Experimental | Register license for auto-decrypt |
119
- | `kdna license activate <domain> --key <key> --server <url>` | Experimental | Activate a license from entitlement source |
120
- | `kdna license sync [domain] [--server <url>]` | Experimental | Refresh entitlement and revocation status |
121
- | `kdna license verify <license.json>` | Experimental | Verify license signature and validity |
122
- | `kdna license bind <license.json>` | Experimental | Bind license to this machine |
123
- | `kdna license show <license.json>` | Experimental | Display license details |
124
- | `kdna license status [domain] [--json]` | Experimental | Show installed license activation status without exposing keys |
125
-
126
- ### Cluster Composition
127
-
128
- | Command | Status | Description |
129
- | -------------------------- | ------- | ------------------------- |
130
- | `kdna cluster lint <path>` | Planned | Validate cluster manifest |
131
-
132
- ### Registry & Distribution
133
-
134
- | Command | Status | Description |
135
- | ------------------------- | ------ | ------------------------------------- |
136
- | `kdna install <name>` | Beta | Install domain from registry |
137
- | `kdna install file.kdna` | Beta | Install from local .kdna asset |
138
- | `kdna remove <name>` | Beta | Uninstall a domain |
139
- | `kdna update <name>` | Beta | Update installed domain |
140
- | `kdna info <name>` | Beta | Show domain metadata and trust status |
141
- | `kdna list [--available]` | Beta | List installed or available domains |
142
- | `kdna search <keyword>` | Beta | Search registry |
143
- | `kdna registry refresh` | Beta | Refresh registry cache |
144
-
145
- ### Identity & Signing
146
-
147
- | Command | Status | Description |
148
- | ------------------------------ | ------------ | ------------------------------- |
149
- | `kdna identity init` | Experimental | Generate Ed25519 signing key |
150
- | `kdna identity show` | Experimental | Display public key and buyer ID |
151
- | `kdna identity export [--out]` | Experimental | Backup private key (encrypted) |
152
- | `kdna identity import <file>` | Experimental | Restore identity from backup |
153
-
154
- ### Setup
155
-
156
- | Command | Status | Description |
157
- | ------------ | ------ | ------------------------------------------ |
158
- | `kdna setup` | Beta | One-command setup: CLI + skill + data root |
159
-
160
- ---
161
-
162
- ## SPEC Compatibility
163
-
164
- KDNA CLI follows the canonical KDNA Container format defined in [`aikdna/kdna`](https://github.com/aikdna/kdna).
165
-
166
- A valid KDNA asset is a `.kdna` container with:
167
- - `kdna.json` — public manifest and metadata (no judgment content)
168
- - `payload.kdnab` — CBOR-encoded judgment payload
169
- - `signature.kdsig` — Ed25519 signature
170
-
171
- The authoring source tree uses standard JSON files (KDNA_Core.json, KDNA_Patterns.json, etc.) for human editing and Git review. These files belong to the source tree only and MUST NOT appear as top-level entries in a distribution `.kdna` asset.
172
-
173
- To create a trusted `.kdna`, use `kdna-studio migrate <source-dir> --out <file.kdna>` or a Studio-compatible compiler that records authoring provenance, Human Lock evidence, compiler metadata, and asset digest.
31
+ Successful validation returns:
32
+
33
+ ```json
34
+ {
35
+ "format_valid": true,
36
+ "schema_valid": true,
37
+ "payload_valid": true,
38
+ "checksums_valid": true,
39
+ "load_contract_valid": true,
40
+ "overall_valid": true,
41
+ "problems": []
42
+ }
43
+ ```
174
44
 
175
- ---
45
+ ## Core Commands
176
46
 
177
- ## Legacy Registry (deprecated)
47
+ | Command | Purpose |
48
+ |---|---|
49
+ | `kdna demo minimal <dir>` | Create a minimal v1 source directory |
50
+ | `kdna inspect <path>` | Inspect a v1 source dir or `.kdna` container |
51
+ | `kdna validate <path>` | Validate format, schema, payload, checksums, and load contract |
52
+ | `kdna pack <source-dir> <output.kdna>` | Pack a v1 source directory |
53
+ | `kdna unpack <input.kdna> <output-dir>` | Unpack a v1 container |
54
+ | `kdna load <path> --profile=<index|compact|scenario|full> --as=<json|prompt>` | Render judgment context for agents or tools |
55
+ | `kdna setup` | Install the `kdna-loader` skill for supported agents |
56
+ | `kdna doctor --agents` | Check agent loader installation |
178
57
 
179
- KDNA Core v1 is the **official KDNA judgment-asset format**. KDNA Core v1 does not define a registry, marketplace, or quality-badge system. Assets are loaded by path or by the official CLI, not by registry name.
58
+ ## Producer Path
180
59
 
181
- The legacy `kdna install <name>` command and the `KDNA_REGISTRY_URL` env var are preserved for backward compatibility with the legacy `kdna-registry` repository (marked as a legacy experiment). New KDNA Core v1 integrations should use the official CLI route:
60
+ Use Studio CLI to create formal v1 `.kdna` assets:
182
61
 
183
62
  ```bash
184
- kdna inspect <path>
185
- kdna validate <path>
186
- kdna pack <source-dir> <output.kdna>
187
- kdna unpack <input.kdna> <output-dir>
63
+ npm install -g @aikdna/kdna-studio-cli
64
+ kdna-studio create my_domain --name @yourscope/my_domain
65
+ kdna-studio migrate ./my_domain --format v1 --out ./my_domain.kdna
66
+ kdna validate ./my_domain.kdna
67
+ kdna load ./my_domain.kdna --profile=compact --as=prompt
188
68
  ```
189
69
 
190
- ---
70
+ ## Legacy Compatibility
191
71
 
192
- ## Official toolchain components
72
+ Older CLI commands for registry install, compare, trace, licensing, identity, or
73
+ pre-v1 dev source workflows may still exist for backward compatibility. They
74
+ are not the KDNA Core v1 launch path.
193
75
 
194
- KDNA Core v1 is the **official KDNA judgment-asset format**. `.kdna` assets are created, inspected, protected, loaded, and consumed through the official KDNA toolchain. Third-party products integrate KDNA through the official SDK, CLI, Loader, or API.
76
+ New integrations should use the v1 Core route:
195
77
 
196
- | Layer | Component | Responsibility |
197
- | ------ | -------------------------- | --------------- |
198
- | Format | KDNA Core | Official KDNA judgment-asset format and runtime loading contract |
199
- | Core Library | @aikdna/kdna-core | Official loader SDK |
200
- | Runtime | @aikdna/kdna-cli | Official CLI: inspect, validate, pack, unpack, load |
201
- | Authoring | KDNA Studio Core | Official authoring kernel |
78
+ ```text
79
+ source or Studio project
80
+ v1 .kdna container
81
+ kdna validate
82
+ kdna load
83
+ agent/runtime context
84
+ ```
202
85
 
203
86
  ## Development
204
87
 
@@ -211,9 +94,10 @@ npm test
211
94
 
212
95
  ## Related
213
96
 
214
- - [@aikdna/kdna-core](https://github.com/aikdna/kdna/tree/main/packages/kdna-core) — Official loader SDK
215
- - [KDNA SPEC](https://github.com/aikdna/kdna) — Official KDNA Core format
216
- - [aikdna.com](https://aikdna.com) — Website
97
+ - [KDNA Core](https://github.com/aikdna/kdna/tree/main/packages/kdna-core)
98
+ - [KDNA Studio CLI](https://github.com/aikdna/kdna-studio-cli)
99
+ - [KDNA Skills](https://github.com/aikdna/kdna-skills)
100
+ - [aikdna.com](https://aikdna.com)
217
101
 
218
102
  ## License
219
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-cli",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "KDNA CLI — runtime control plane for verifying, installing, loading, comparing, publishing, and auditing existing .kdna assets.",
5
5
  "type": "commonjs",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -61,6 +61,10 @@ if (!args.length || args[0] === '--help' || args[0] === '-h') {
61
61
  showHelp();
62
62
  process.exit(0);
63
63
  }
64
+ if (args[0] === '--version' || args[0] === '-v') {
65
+ console.log(require('../package.json').version);
66
+ process.exit(0);
67
+ }
64
68
  if (args[0] === 'help') {
65
69
  const sub = args[1];
66
70
  if (sub === 'advanced' || sub === 'legacy') {
@@ -138,7 +142,7 @@ function showHelpLegacy() {
138
142
  Not part of the current KDNA Core v1 first-run path. Preserved for
139
143
  backward compatibility. These commands may change or be removed.
140
144
 
141
- Registry (legacy — kdna-registry is a legacy experiment):
145
+ Registry (legacy compatibility not a Core v1 public path):
142
146
  install <name> Install domain from legacy registry
143
147
  remove <name> Uninstall a domain
144
148
  update <name> Update installed domain
package/src/publish.js CHANGED
@@ -689,12 +689,12 @@ function cmdPublish(assetPath, args = []) {
689
689
 
690
690
  console.log('');
691
691
  console.log('─'.repeat(60));
692
- console.log('Registry patch (apply to kdna-registry/domains.json):');
692
+ console.log('Legacy registry patch (historical compatibility only):');
693
693
  console.log('─'.repeat(60));
694
694
  console.log(JSON.stringify(patch, null, 2));
695
695
  console.log('');
696
696
  console.log(
697
- `Next: open a PR to kdna-registry merging this patch into the matching entry by "name".`,
697
+ `Next: do not open a public registry PR. Core v1 publishes local .kdna files through validate/load evidence, not a central registry.`,
698
698
  );
699
699
  }
700
700
 
@@ -43,18 +43,15 @@ kdna identity init
43
43
  # 6. Verify quality
44
44
  kdna verify ./.
45
45
 
46
- # 7. Publish
46
+ # 7. Export and verify the local v1 asset
47
47
  KDNA_IDENTITY_DIR=~/.kdna/identity-official \
48
- # Trusted publish starts from a Studio-compiled .kdna asset.
49
- kdna publish ./dist/your-domain.kdna \
50
- --release-tag v0.1.0 \
51
- --repo yourname/kdna-<your_domain_id>
48
+ kdna validate ./dist/your-domain.kdna
52
49
 
53
- # 8. Open PR to kdna-registry with the patch JSON the command printed
50
+ kdna load ./dist/your-domain.kdna --profile=compact --as=prompt
54
51
  ```
55
52
 
56
53
  ## Standard vs minimal-domain
57
54
 
58
55
  `minimal-domain/` is the **bare-minimum** template — 2 files, no v2.1 fields, no evals. Use it only for fast experimentation or learning.
59
56
 
60
- `standard-domain/` is the **registry-ready** template. Any domain meant to be published to the registry should start here and aim for `kdna verify --judgment` 80% before publishing.
57
+ `standard-domain/` is the richer authoring template for domains that need evidence, limitations, and repeatable validation. Core v1 distribution is local `.kdna` export plus `kdna validate` / `kdna load` evidence, not a central registry submission.