@aikdna/kdna-studio-cli 0.6.0 → 0.6.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.
@@ -908,16 +908,26 @@ function cmdFilter(args) {
908
908
  }
909
909
  }
910
910
 
911
- const AXIOM_REQUIRED_FIELDS = [
912
- 'one_sentence', 'full_statement', 'why',
913
- 'applies_when', 'does_not_apply_when', 'failure_risk',
914
- 'confidence', 'evidence_type',
915
- ];
911
+ const CARD_REQUIRED_FIELDS = {
912
+ axiom: [
913
+ 'one_sentence', 'full_statement', 'why',
914
+ 'applies_when', 'does_not_apply_when', 'failure_risk',
915
+ 'confidence', 'evidence_type',
916
+ ],
917
+ boundary: ['scope', 'out_of_scope'],
918
+ misunderstanding: ['wrong', 'correct', 'key_distinction', 'why'],
919
+ self_check: ['question'],
920
+ scenario: ['name', 'trigger', 'action', 'expected'],
921
+ case: ['title', 'scenario', 'input', 'expected'],
922
+ risk: ['name', 'description', 'mitigation'],
923
+ stance: ['statement'],
924
+ };
916
925
 
917
926
  function checkRequiredFields(type, fields) {
918
- if (type !== 'axiom') return [];
927
+ const required = CARD_REQUIRED_FIELDS[type];
928
+ if (!required) return [];
919
929
  const missing = [];
920
- for (const f of AXIOM_REQUIRED_FIELDS) {
930
+ for (const f of required) {
921
931
  const val = fields[f];
922
932
  if (val === undefined || val === null || val === '' ||
923
933
  (Array.isArray(val) && val.length === 0)) {
@@ -927,9 +937,11 @@ function checkRequiredFields(type, fields) {
927
937
  return missing;
928
938
  }
929
939
 
930
- function axiomStrictTemplate(fields) {
940
+ function cardStrictTemplate(type, fields) {
941
+ const required = CARD_REQUIRED_FIELDS[type];
942
+ if (!required) return fields;
931
943
  const filled = { ...fields };
932
- for (const f of AXIOM_REQUIRED_FIELDS) {
944
+ for (const f of required) {
933
945
  const val = filled[f];
934
946
  if (val === undefined || val === null || val === '' ||
935
947
  (Array.isArray(val) && val.length === 0)) {
@@ -957,16 +969,17 @@ function cmdCard(args) {
957
969
 
958
970
  const useTemplate = option(args, '--template');
959
971
  if (useTemplate === 'axiom-strict') {
960
- fields = axiomStrictTemplate(fields);
972
+ if (type !== 'axiom') fail('--template axiom-strict only applies to axiom cards');
973
+ fields = cardStrictTemplate('axiom', fields);
961
974
  }
962
975
 
963
976
  const isNoStrict = args.includes('--no-strict');
964
- if (!isNoStrict && type === 'axiom') {
977
+ if (!isNoStrict) {
965
978
  const missing = checkRequiredFields(type, fields);
966
979
  if (missing.length > 0) {
967
980
  fail(
968
- `Missing required fields for axiom: ${missing.join(', ')}\n` +
969
- `Use --no-strict to add a partial card, or --template axiom-strict for placeholders.`
981
+ `Missing required fields for ${type}: ${missing.join(', ')}\n` +
982
+ `Use --no-strict to add a partial card.`
970
983
  );
971
984
  }
972
985
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-studio-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.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": {
package/tests/cli.test.js CHANGED
@@ -677,6 +677,7 @@ test('E2E blank: create → approve → lock → export → runtime digest match
677
677
  '--field', 'wrong=E2E tests are unnecessary.',
678
678
  '--field', 'correct=E2E tests catch integration issues not visible in unit tests.',
679
679
  '--field', 'key_distinction=E2E tests validate the full pipeline, not individual functions.',
680
+ '--field', 'why=E2E test failures are hard to debug without a full integration test running.',
680
681
  ], { tmp });
681
682
  assert.equal(result.status, 0, result.stderr);
682
683