@aikdna/kdna-studio-cli 0.9.0 → 0.9.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/bin/kdna-studio.js +29 -19
- package/package.json +1 -1
package/bin/kdna-studio.js
CHANGED
|
@@ -593,14 +593,14 @@ function buildManifest(project, name) {
|
|
|
593
593
|
return {
|
|
594
594
|
kdna_version: '1.0',
|
|
595
595
|
asset_id: assetId,
|
|
596
|
-
asset_uid: project.asset_uid || 'urn:uuid:' + crypto.randomUUID(),
|
|
596
|
+
asset_uid: project.asset_uid || source.asset_uid || 'urn:uuid:' + crypto.randomUUID(),
|
|
597
597
|
asset_type: project.type === 'cluster' ? 'cluster' : 'domain',
|
|
598
598
|
source_asset_type: source.asset_type || null,
|
|
599
599
|
title: titleFromName(source.name || name || project.name, assetId),
|
|
600
600
|
version: semverValue(project.release?.version || source.version, '1.0.0'),
|
|
601
601
|
judgment_version: semverValue(project.release?.judgment_version || source.judgment_version || source.version, '1.0.0'),
|
|
602
|
-
created_at: isoDateTime(source.created || project.created),
|
|
603
|
-
updated_at: isoDateTime(source.updated || project.updated),
|
|
602
|
+
created_at: isoDateTime(source.created_at || source.created || project.created),
|
|
603
|
+
updated_at: isoDateTime(source.updated_at || source.updated || project.updated),
|
|
604
604
|
creator: {
|
|
605
605
|
name: author.name || project.author?.name || 'Studio Export',
|
|
606
606
|
id: author.id || project.author?.id || undefined,
|
|
@@ -821,6 +821,7 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
821
821
|
if (manifest) {
|
|
822
822
|
manifestData.raw = manifest;
|
|
823
823
|
if (manifest.version) manifestData.version = manifest.version;
|
|
824
|
+
if (manifest.asset_uid) manifestData.asset_uid = manifest.asset_uid;
|
|
824
825
|
if (manifest.judgment_version) manifestData.judgment_version = manifest.judgment_version;
|
|
825
826
|
if (manifest.languages) manifestData.languages = manifest.languages;
|
|
826
827
|
if (manifest.default_language) manifestData.default_language = manifest.default_language;
|
|
@@ -831,8 +832,8 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
831
832
|
if (manifest.author) manifestData.author = manifest.author;
|
|
832
833
|
if (manifest.asset_type) manifestData.asset_type = manifest.asset_type;
|
|
833
834
|
if (manifest.core_insight) manifestData.core_insight = manifest.core_insight;
|
|
834
|
-
if (manifest.created) manifestData.created = manifest.created;
|
|
835
|
-
if (manifest.updated) manifestData.updated = manifest.updated;
|
|
835
|
+
if (manifest.created_at || manifest.created) manifestData.created = manifest.created_at || manifest.created;
|
|
836
|
+
if (manifest.updated_at || manifest.updated) manifestData.updated = manifest.updated_at || manifest.updated;
|
|
836
837
|
if (manifest.risk_level) manifestData.risk_level = manifest.risk_level;
|
|
837
838
|
if (manifest.fitness_for_purpose) manifestData.fitness_for_purpose = manifest.fitness_for_purpose;
|
|
838
839
|
}
|
|
@@ -869,20 +870,20 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
869
870
|
if (key in ax) fields[key] = ax[key];
|
|
870
871
|
else audit.missingFields.push(`axiom.${ax.id || '?'}.${key}`);
|
|
871
872
|
}
|
|
872
|
-
importedCards.push(cardApi.createCard('axiom', fields));
|
|
873
|
+
importedCards.push(cardApi.createCard('axiom', fields, ax.id || null));
|
|
873
874
|
}
|
|
874
875
|
for (const ont of (Array.isArray(core.ontology) ? core.ontology : [])) {
|
|
875
876
|
importedCards.push(cardApi.createCard('ontology', {
|
|
876
877
|
one_sentence: ont.one_sentence || ont.essence || '',
|
|
877
878
|
essence: ont.essence || '', boundary: ont.boundary || '',
|
|
878
879
|
trigger_signal: ont.trigger_signal || '',
|
|
879
|
-
}));
|
|
880
|
+
}, ont.id || null));
|
|
880
881
|
}
|
|
881
882
|
for (const b of (Array.isArray(core.boundaries) ? core.boundaries : [])) {
|
|
882
883
|
importedCards.push(cardApi.createCard('boundary', {
|
|
883
884
|
scope: b.scope || '', out_of_scope: b.out_of_scope || '',
|
|
884
885
|
acceptable_exceptions: b.acceptable_exceptions || [],
|
|
885
|
-
}));
|
|
886
|
+
}, b.id || null));
|
|
886
887
|
}
|
|
887
888
|
// Accept risks as a top-level array (`risks`) or wrapped in `risk_model`
|
|
888
889
|
// (either as `{risks: [...]}` or as an array itself).
|
|
@@ -893,7 +894,7 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
893
894
|
else risksSource = [];
|
|
894
895
|
}
|
|
895
896
|
for (const r of risksSource) {
|
|
896
|
-
importedCards.push(cardApi.createCard('risk', r.fields || r));
|
|
897
|
+
importedCards.push(cardApi.createCard('risk', r.fields || r, r.id || null));
|
|
897
898
|
}
|
|
898
899
|
// NEW: import stances
|
|
899
900
|
for (const s of (Array.isArray(core.stances) ? core.stances : [])) {
|
|
@@ -902,14 +903,14 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
902
903
|
statement: text,
|
|
903
904
|
applies_when: s.applies_when || [],
|
|
904
905
|
does_not_apply_when: s.does_not_apply_when || [],
|
|
905
|
-
}));
|
|
906
|
+
}, typeof s === 'object' ? s.id || null : null));
|
|
906
907
|
}
|
|
907
908
|
// NEW: import frameworks
|
|
908
909
|
for (const fw of (Array.isArray(core.frameworks) ? core.frameworks : [])) {
|
|
909
910
|
importedCards.push(cardApi.createCard('framework', {
|
|
910
911
|
name: fw.name || '', when_to_use: fw.when_to_use || '',
|
|
911
912
|
steps: fw.steps || [],
|
|
912
|
-
}));
|
|
913
|
+
}, fw.id || null));
|
|
913
914
|
}
|
|
914
915
|
}
|
|
915
916
|
|
|
@@ -919,23 +920,27 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
919
920
|
for (const t of (Array.isArray(patterns.terminology.standard_terms) ? patterns.terminology.standard_terms : [])) {
|
|
920
921
|
importedCards.push(cardApi.createCard('term', {
|
|
921
922
|
term: t.term || '', definition: t.definition || '',
|
|
922
|
-
}));
|
|
923
|
+
}, t.id || null));
|
|
923
924
|
}
|
|
924
925
|
for (const bt of (Array.isArray(patterns.terminology.banned_terms) ? patterns.terminology.banned_terms : [])) {
|
|
925
926
|
importedCards.push(cardApi.createCard('banned_term', {
|
|
926
927
|
term: bt.term || '', why: bt.why || '', replace_with: bt.replace_with || '',
|
|
927
|
-
}));
|
|
928
|
+
}, bt.id || null));
|
|
928
929
|
}
|
|
929
930
|
}
|
|
930
931
|
for (const ms of (Array.isArray(patterns.misunderstandings) ? patterns.misunderstandings : [])) {
|
|
931
932
|
importedCards.push(cardApi.createCard('misunderstanding', {
|
|
932
933
|
wrong: ms.wrong || '', correct: ms.correct || '',
|
|
933
934
|
key_distinction: ms.key_distinction || '', why: ms.why || '',
|
|
934
|
-
}));
|
|
935
|
+
}, ms.id || null));
|
|
935
936
|
}
|
|
936
937
|
for (const sc of (Array.isArray(patterns.self_check) ? patterns.self_check : [])) {
|
|
937
938
|
const q = typeof sc === 'string' ? sc : sc.question || '';
|
|
938
|
-
importedCards.push(cardApi.createCard(
|
|
939
|
+
importedCards.push(cardApi.createCard(
|
|
940
|
+
'self_check',
|
|
941
|
+
{ question: q },
|
|
942
|
+
typeof sc === 'object' ? sc.id || null : null,
|
|
943
|
+
));
|
|
939
944
|
}
|
|
940
945
|
// Bug (aesthetic round-trip): prior version dropped
|
|
941
946
|
// `patterns.aesthetics` on import. `cardsFromRuntimePayload` and
|
|
@@ -944,7 +949,11 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
944
949
|
// them when imported through `create --from-folder`. The fix
|
|
945
950
|
// adds the missing loop here.
|
|
946
951
|
for (const aesthetic of (Array.isArray(patterns.aesthetics) ? patterns.aesthetics : [])) {
|
|
947
|
-
importedCards.push(cardApi.createCard(
|
|
952
|
+
importedCards.push(cardApi.createCard(
|
|
953
|
+
'aesthetic',
|
|
954
|
+
aesthetic.fields || aesthetic,
|
|
955
|
+
aesthetic.id || null,
|
|
956
|
+
));
|
|
948
957
|
}
|
|
949
958
|
}
|
|
950
959
|
|
|
@@ -954,7 +963,7 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
954
963
|
importedCards.push(cardApi.createCard('scenario', {
|
|
955
964
|
name: scene.name || scene.id || '',
|
|
956
965
|
trigger: scene.trigger || '', action: scene.action || '',
|
|
957
|
-
}));
|
|
966
|
+
}, scene.id || null));
|
|
958
967
|
}
|
|
959
968
|
}
|
|
960
969
|
|
|
@@ -964,7 +973,7 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
964
973
|
importedCards.push(cardApi.createCard('case', {
|
|
965
974
|
title: c.title || c.id || '',
|
|
966
975
|
scenario: c.scenario || '', expected: c.expected || '',
|
|
967
|
-
}));
|
|
976
|
+
}, c.id || null));
|
|
968
977
|
}
|
|
969
978
|
}
|
|
970
979
|
|
|
@@ -985,7 +994,7 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
985
994
|
concrete_action: rc.concrete_action || rc.so_what || '',
|
|
986
995
|
so_what: rc.so_what || rc.concrete_action || '',
|
|
987
996
|
conclusion: rc.conclusion || '',
|
|
988
|
-
}));
|
|
997
|
+
}, rc.id || null));
|
|
989
998
|
}
|
|
990
999
|
}
|
|
991
1000
|
|
|
@@ -1009,6 +1018,7 @@ function importFromFolder(sourceDir, projectDir, projectName, creatorIdentity, o
|
|
|
1009
1018
|
lineage: { type: 'migrated', parent_name: manifestData.name || null, parent_asset_uid: null, parent_version: manifestData.version || null, parent_asset_digest: null },
|
|
1010
1019
|
});
|
|
1011
1020
|
// Preserve manifest metadata
|
|
1021
|
+
if (manifestData.asset_uid) project.asset_uid = manifestData.asset_uid;
|
|
1012
1022
|
if (manifestData.version) {
|
|
1013
1023
|
if (!project.release) project.release = {};
|
|
1014
1024
|
project.release.version = manifestData.version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aikdna/kdna-studio-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
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": {
|