@aikdna/kdna-studio-cli 0.8.4 → 0.8.5
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/bin/kdna-studio.js +55 -3
- package/package.json +2 -2
package/bin/kdna-studio.js
CHANGED
|
@@ -50,7 +50,7 @@ Create (three entry paths):
|
|
|
50
50
|
kdna-studio create <project-dir> --from-folder <source-dir> --name <@scope/name>
|
|
51
51
|
|
|
52
52
|
Migrate (dev source or Studio project → canonical .kdna in one command):
|
|
53
|
-
kdna-studio migrate <source-dir|project> --format v1 --out <file.kdna> --name <@scope/name> --by <id> --statement <text> [--allow-incomplete]
|
|
53
|
+
kdna-studio migrate <source-dir|project> --format v1 --out <file.kdna> --name <@scope/name> --by <id> --statement <text> [--allow-incomplete] [--sign] [--passphrase <pw>|--passphrase-stdin]
|
|
54
54
|
|
|
55
55
|
Authoring:
|
|
56
56
|
kdna-studio import <project> <source-file-or-dir> # import evidence (txt/md/json/yaml/csv/log/srt/vtt/html)
|
|
@@ -304,6 +304,14 @@ function decodePayload(bytes, manifest = {}) {
|
|
|
304
304
|
return cbor.decode(raw);
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
// V1 path: trust the producer (export-runtime) to have already shaped
|
|
308
|
+
// each card's fields. The v1 producer normalises everything into a
|
|
309
|
+
// canonical shape, so we just round-trip the raw object. Bug (#57):
|
|
310
|
+
// the legacy path below explicitly constructs each field. The two
|
|
311
|
+
// paths cannot be unified without losing either v1's per-field
|
|
312
|
+
// guarantees or legacy's defensive defaults — the asymmetry is
|
|
313
|
+
// intentional. Documented here so a future reader does not "fix" it
|
|
314
|
+
// by collapsing one path into the other.
|
|
307
315
|
function cardsFromV1Payload(payload) {
|
|
308
316
|
const cards = [];
|
|
309
317
|
for (const sourceCard of (payload.source_cards || [])) {
|
|
@@ -477,6 +485,19 @@ function cardsFromPayload(payload) {
|
|
|
477
485
|
}
|
|
478
486
|
|
|
479
487
|
function buildV1Manifest(project, name) {
|
|
488
|
+
// Bug (#58): prior version was a hand-rolled manifest builder that
|
|
489
|
+
// shared zero logic with the canonical buildManifest in
|
|
490
|
+
// @aikdna/kdna-studio-core/src/export-runtime. The two paths
|
|
491
|
+
// diverged on every field added since 1.0 (lineage, load_contract,
|
|
492
|
+
// authoring block, etc.). The fix delegates the manifest shape to
|
|
493
|
+
// kdna-studio-core's buildManifest so the v1 path is the single
|
|
494
|
+
// source of truth.
|
|
495
|
+
//
|
|
496
|
+
// We still need a default manifest here (the exportRuntimeAsset
|
|
497
|
+
// path uses buildManifest internally; this function supplies the
|
|
498
|
+
// defaults that pass-through into the runtime options). The actual
|
|
499
|
+
// manifest the runtime ships is the one buildManifest produces, so
|
|
500
|
+
// keeping these defaults in sync matters less than it used to.
|
|
480
501
|
const source = project.source_manifest || {};
|
|
481
502
|
const assetId = assetIdFromName(name || source.name || project.name);
|
|
482
503
|
const author = source.author || project.author || {};
|
|
@@ -556,6 +577,14 @@ function cmdCreate(args) {
|
|
|
556
577
|
lineage,
|
|
557
578
|
});
|
|
558
579
|
project.cards = kdnaData.cards;
|
|
580
|
+
// Bug #15 / #28 follow-up: store the source KDNA_* files on the
|
|
581
|
+
// project so a later export through exportRuntimeAsset can
|
|
582
|
+
// forward them to compileDomain (which then preserves
|
|
583
|
+
// changelog / version_notes / reasoning_chains / banned_terms
|
|
584
|
+
// through the round-trip).
|
|
585
|
+
if (kdnaData.source_patterns) project.source_patterns = kdnaData.source_patterns;
|
|
586
|
+
if (kdnaData.source_reasoning) project.source_reasoning = kdnaData.source_reasoning;
|
|
587
|
+
if (kdnaData.source_evolution) project.source_evolution = kdnaData.source_evolution;
|
|
559
588
|
if (kdnaData.source_manifest) project.source_manifest = publicManifestMetadata(kdnaData.source_manifest);
|
|
560
589
|
if (kdnaData.source_manifest?.version) {
|
|
561
590
|
if (!project.release) project.release = {};
|
|
@@ -694,7 +723,30 @@ function importFromKdna(kdnaPath) {
|
|
|
694
723
|
fail(`No cards could be extracted from ${absKdna}. Expected payload.kdnab (v1) or KDNA_Core.json + KDNA_Patterns.json (legacy).`);
|
|
695
724
|
}
|
|
696
725
|
|
|
697
|
-
|
|
726
|
+
// Bug #15 / #28 follow-up: surface the source's KDNA_Patterns /
|
|
727
|
+
// KDNA_Reasoning / KDNA_Evolution entries so cmdCreate can store
|
|
728
|
+
// them on the project. The next export then forwards them to
|
|
729
|
+
// compileDomain via exportRuntimeAsset, which preserves
|
|
730
|
+
// changelog / version_notes / reasoning_chains / banned_terms
|
|
731
|
+
// through the round-trip.
|
|
732
|
+
const sourcePatterns = entries.has('KDNA_Patterns.json')
|
|
733
|
+
? JSON.parse(entries.get('KDNA_Patterns.json').toString())
|
|
734
|
+
: null;
|
|
735
|
+
const sourceReasoning = entries.has('KDNA_Reasoning.json')
|
|
736
|
+
? JSON.parse(entries.get('KDNA_Reasoning.json').toString())
|
|
737
|
+
: null;
|
|
738
|
+
const sourceEvolution = entries.has('KDNA_Evolution.json')
|
|
739
|
+
? JSON.parse(entries.get('KDNA_Evolution.json').toString())
|
|
740
|
+
: null;
|
|
741
|
+
|
|
742
|
+
return {
|
|
743
|
+
lineage,
|
|
744
|
+
cards: importedCards,
|
|
745
|
+
source_manifest: manifest,
|
|
746
|
+
source_patterns: sourcePatterns,
|
|
747
|
+
source_reasoning: sourceReasoning,
|
|
748
|
+
source_evolution: sourceEvolution,
|
|
749
|
+
};
|
|
698
750
|
}
|
|
699
751
|
|
|
700
752
|
/**
|
|
@@ -1391,7 +1443,7 @@ function cmdMigrate(args) {
|
|
|
1391
1443
|
const requestedName = option(args, '--name');
|
|
1392
1444
|
let name = requestedName || path.basename(path.resolve(sourceDir || '.'));
|
|
1393
1445
|
if (!sourceDir || !out || !by || !statement) {
|
|
1394
|
-
fail('Usage: kdna-studio migrate <source-dir> --out <file.kdna> --name <@scope/name> --by <id> --statement <text> [--sign] [--passphrase <
|
|
1446
|
+
fail('Usage: kdna-studio migrate <source-dir> --out <file.kdna> --name <@scope/name> --by <id> --statement <text> [--sign] [--passphrase <pw>|--passphrase-stdin]');
|
|
1395
1447
|
}
|
|
1396
1448
|
|
|
1397
1449
|
const sourcePath = path.resolve(sourceDir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aikdna/kdna-studio-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Official KDNA Studio command-line authoring entry for creating, reviewing, compiling, and exporting .kdna judgment assets through the KDNA toolchain.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=18"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@aikdna/kdna-studio-core": "^1.7.
|
|
42
|
+
"@aikdna/kdna-studio-core": "^1.7.4",
|
|
43
43
|
"ajv": "^8.20.0",
|
|
44
44
|
"ajv-formats": "^3.0.1",
|
|
45
45
|
"cbor-x": "^1.6.4"
|