@aikdna/kdna-studio-cli 0.3.1 → 0.3.2

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.
Files changed (2) hide show
  1. package/bin/kdna-studio.js +28 -1
  2. package/package.json +1 -1
@@ -710,6 +710,27 @@ function cmdMigrate(args) {
710
710
  try { creatorIdentity = creatorApi.loadIdentity(); } catch { /* proceed without */ }
711
711
  const { project } = importFromFolder(sourceDir, tmpDir, name, creatorIdentity);
712
712
 
713
+ // Reject if critical judgment fields are missing from axioms
714
+ const criticalMissing = [];
715
+ for (const card of (project.cards || [])) {
716
+ if (card.type !== 'axiom') continue;
717
+ for (const field of ['applies_when', 'does_not_apply_when', 'failure_risk']) {
718
+ const val = card.fields && card.fields[field];
719
+ if (!val || (Array.isArray(val) && val.length === 0) || val === '') {
720
+ criticalMissing.push(`${card.id}: missing ${field}`);
721
+ }
722
+ }
723
+ }
724
+ if (criticalMissing.length > 0) {
725
+ fail(
726
+ `Cannot migrate: ${criticalMissing.length} critical fields missing from axioms.\n` +
727
+ ` These fields are required for domain routing (kdna-loader uses them to\n` +
728
+ ` decide when to load this domain). Add them to your source files first.\n` +
729
+ ` Missing:\n ` + criticalMissing.slice(0, 10).join('\n ') +
730
+ (criticalMissing.length > 10 ? `\n ... and ${criticalMissing.length - 10} more` : '')
731
+ );
732
+ }
733
+
713
734
  // Step 2: approve and Human Lock all cards
714
735
  let locked = 0;
715
736
  for (let i = 0; i < (project.cards || []).length; i++) {
@@ -760,7 +781,13 @@ function cmdMigrate(args) {
760
781
 
761
782
  if (args.includes('--sign')) applySignature(files, option(args, '--passphrase'));
762
783
  const absOut = path.resolve(out);
763
- buildZip(files, absOut);
784
+ const entries = [['mimetype', files.mimetype]];
785
+ for (const name of Object.keys(files).filter(k => k !== 'mimetype').sort()) {
786
+ entries.push([name, files[name]]);
787
+ }
788
+ const zip = buildZip(entries);
789
+ fs.mkdirSync(path.dirname(absOut), { recursive: true });
790
+ fs.writeFileSync(absOut, zip);
764
791
  console.log(`Exported: ${absOut}`);
765
792
  console.log(` Name: ${name}`);
766
793
  console.log(` Cards: ${project.cards.length} (${locked} locked)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-studio-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Official KDNA Studio command-line authoring entry for creating, locking, compiling, and exporting trusted .kdna assets.",
5
5
  "type": "commonjs",
6
6
  "bin": {