@aikdna/kdna-cli 0.16.3 → 0.16.4
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/package.json +1 -1
- package/src/cli.js +4 -2
- package/src/cmds/domain.js +33 -13
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -252,8 +252,10 @@ switch (cmd) {
|
|
|
252
252
|
}
|
|
253
253
|
case 'inspect': {
|
|
254
254
|
const target = args.filter((a) => !a.startsWith('--'))[1];
|
|
255
|
-
if (!target) error('Usage: kdna inspect <path>');
|
|
256
|
-
|
|
255
|
+
if (!target) error('Usage: kdna inspect <path> [--json] [--locale zh-CN]');
|
|
256
|
+
const localeIdx = args.indexOf('--locale');
|
|
257
|
+
const locale = localeIdx >= 0 ? args[localeIdx + 1] : null;
|
|
258
|
+
cmdInspect(target, args.includes('--json'), locale);
|
|
257
259
|
break;
|
|
258
260
|
}
|
|
259
261
|
case 'verify': {
|
package/src/cmds/domain.js
CHANGED
|
@@ -587,14 +587,14 @@ function parseSimpleYaml(raw) {
|
|
|
587
587
|
|
|
588
588
|
// ─── Inspect ───────────────────────────────────────────────────────────
|
|
589
589
|
|
|
590
|
-
function cmdInspect(dir, jsonMode = false) {
|
|
590
|
+
function cmdInspect(dir, jsonMode = false, locale = null) {
|
|
591
591
|
const abs = path.resolve(dir);
|
|
592
592
|
const stat = fs.existsSync(abs) ? fs.statSync(abs) : null;
|
|
593
593
|
if (!stat) error(`Path not found: ${abs}`, EXIT.INPUT_ERROR);
|
|
594
594
|
|
|
595
595
|
// Single .kdna file
|
|
596
596
|
if (stat.isFile() && abs.endsWith('.kdna')) {
|
|
597
|
-
inspectKdnaFile(abs, jsonMode);
|
|
597
|
+
inspectKdnaFile(abs, jsonMode, locale);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
600
|
|
|
@@ -657,18 +657,27 @@ function cmdInspect(dir, jsonMode = false) {
|
|
|
657
657
|
axioms: (c.axioms || []).map((a) => a.one_sentence || null).filter(Boolean),
|
|
658
658
|
};
|
|
659
659
|
|
|
660
|
-
//
|
|
661
|
-
|
|
662
|
-
if (card) {
|
|
660
|
+
// Add governance + locale data
|
|
661
|
+
if (kdnaCard) {
|
|
663
662
|
result.governance = {
|
|
664
|
-
risk_level:
|
|
665
|
-
review_status:
|
|
666
|
-
intended_use:
|
|
667
|
-
out_of_scope:
|
|
668
|
-
known_limitations:
|
|
669
|
-
requires_expert_review:
|
|
663
|
+
risk_level: kdnaCard.risk_level || null,
|
|
664
|
+
review_status: kdnaCard.review_status || null,
|
|
665
|
+
intended_use: kdnaCard.intended_use || [],
|
|
666
|
+
out_of_scope: kdnaCard.out_of_scope || [],
|
|
667
|
+
known_limitations: kdnaCard.known_limitations || [],
|
|
668
|
+
requires_expert_review: kdnaCard.requires_expert_review || false,
|
|
670
669
|
};
|
|
670
|
+
if (locale) {
|
|
671
|
+
result.governance.display_name = kdnaCard.display_name || null;
|
|
672
|
+
result.governance.summary = kdnaCard.summary || null;
|
|
673
|
+
result.governance.locale = locale;
|
|
674
|
+
}
|
|
671
675
|
}
|
|
676
|
+
// Add i18n info from kdna.json
|
|
677
|
+
if (m.languages) result.languages = m.languages;
|
|
678
|
+
if (m.default_language) result.default_language = m.default_language;
|
|
679
|
+
if (m.i18n_level) result.i18n_level = m.i18n_level;
|
|
680
|
+
|
|
672
681
|
console.log(JSON.stringify(result, null, 2));
|
|
673
682
|
return;
|
|
674
683
|
}
|
|
@@ -718,11 +727,22 @@ function cmdInspect(dir, jsonMode = false) {
|
|
|
718
727
|
|
|
719
728
|
if (evo) console.log(` Evolution stages: ${(evo.stages || []).length}`);
|
|
720
729
|
|
|
721
|
-
// Governance metadata
|
|
722
|
-
|
|
730
|
+
// Governance metadata (with locale support)
|
|
731
|
+
let kdnaCard = readJson(path.join(abs, 'KDNA_CARD.json'));
|
|
732
|
+
if (locale && !kdnaCard) {
|
|
733
|
+
kdnaCard = readJson(path.join(abs, 'locales', locale, 'KDNA_CARD.json'));
|
|
734
|
+
}
|
|
735
|
+
if (locale && kdnaCard) {
|
|
736
|
+
const localeCard = readJson(path.join(abs, 'locales', locale, 'KDNA_CARD.json'));
|
|
737
|
+
if (localeCard) kdnaCard = localeCard;
|
|
738
|
+
}
|
|
723
739
|
if (kdnaCard) {
|
|
740
|
+
const displayName = kdnaCard.display_name || '';
|
|
741
|
+
const summary = kdnaCard.summary || '';
|
|
724
742
|
console.log('');
|
|
725
743
|
console.log(' ── Governance ──');
|
|
744
|
+
if (displayName && locale) console.log(` Display name: ${displayName}`);
|
|
745
|
+
if (summary && locale) console.log(` Summary: ${summary}`);
|
|
726
746
|
console.log(` Risk level: ${kdnaCard.risk_level || '?'}`);
|
|
727
747
|
console.log(` Review status: ${kdnaCard.review_status || '?'}`);
|
|
728
748
|
if (kdnaCard.intended_use?.length) console.log(` Intended use: ${kdnaCard.intended_use[0]}${kdnaCard.intended_use.length > 1 ? ` (+${kdnaCard.intended_use.length - 1} more)` : ''}`);
|