@aikdna/kdna-studio-cli 0.3.3 → 0.5.0

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Official Studio command-line entry for KDNA judgment asset creation — turns your notes, documents, works, and feedback into loadable .kdna domains.
4
4
 
5
+ **Official** means this package is part of the KDNA official toolchain. It does not imply content trust, asset endorsement, registry status, or quality rating.
6
+
5
7
  Two authoring paths: interview-first (articulate your judgment directly) and distillation-first (provide content, find the patterns, confirm what's really you).
6
8
 
7
9
  Distillation-first authoring is domain-first: declare the target domain, owner scope, granularity, task scope, include areas, exclude areas, and load condition before extracting candidates. A single `.kdna` should stay scoped; complex work should compose multiple domain assets through a KDNA Cluster.
@@ -772,15 +772,47 @@ function cmdMigrate(args) {
772
772
  fail(`Human Lock Gate blocked: ${reasons}`, EXIT.HUMAN_LOCK_REQUIRED);
773
773
  }
774
774
 
775
- // Step 4: compile and export as .kdna
775
+ const absOut = path.resolve(out);
776
+ // Step 4: v1 export or v2 compile + export
777
+ if (args.includes('--format') && option(args, '--format') === 'v1') {
778
+ let core;
779
+ try { core = require('@aikdna/kdna-core'); } catch (e) {
780
+ fail('@aikdna/kdna-core@0.11.0+ is required for v1 export.', 2);
781
+ }
782
+ const lockedAxioms = (project.cards || []).filter(c => c.type === 'axiom' && c.locked);
783
+ const v1Dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kdna-v1-'));
784
+ fs.writeFileSync(path.join(v1Dir, 'mimetype'), 'application/vnd.kdna.asset');
785
+ fs.writeFileSync(path.join(v1Dir, 'kdna.json'), JSON.stringify({
786
+ kdna_version: '1.0', asset_id: name || 'studio:v1-export',
787
+ asset_uid: 'urn:uuid:' + crypto.randomUUID(), asset_type: 'domain',
788
+ title: name || 'Studio v1 Export', version: '1.0.0',
789
+ judgment_version: '1.0.0',
790
+ created_at: new Date().toISOString(), updated_at: new Date().toISOString(),
791
+ creator: { name: 'Studio Export' },
792
+ compatibility: { min_loader_version: '1.0.0', profile: 'judgment-profile-v1' },
793
+ payload: { path: 'payload.kdnab', encoding: 'json', encrypted: false },
794
+ lineage: { type: 'original', fork_of: null, derived_from: null },
795
+ }, null, 2));
796
+ fs.writeFileSync(path.join(v1Dir, 'payload.kdnab'), JSON.stringify({
797
+ profile: 'judgment-profile-v1',
798
+ core: { highest_question: '', axioms: lockedAxioms.map(c => ({ one_sentence: c.fields?.one_sentence || c.summary || '' })), boundaries: [], risk_model: {} },
799
+ patterns: [], scenarios: [], cases: [], reasoning: { self_checks: [], failure_modes: [] },
800
+ }, null, 2));
801
+ core.pack(v1Dir, absOut);
802
+ const vr = core.validate(absOut);
803
+ if (!vr.overall_valid) fail('v1 export validation failed: ' + (vr.problems || []).join('; '));
804
+ console.log('Exported (v1): ' + absOut);
805
+ console.log(' Name: ' + name + ' Axioms: ' + lockedAxioms.length + ' Validated: all gates pass');
806
+ try { fs.rmSync(v1Dir, { recursive: true }); } catch { /* cleanup */ }
807
+ try { fs.rmSync(tmpDir, { recursive: true }); } catch { /* cleanup */ }
808
+ return;
809
+ }
776
810
  const { result } = compileProject(tmpDir);
777
811
  const files = { ...result.files };
778
812
  files['README.md'] = compileApi.generateReadme(project);
779
813
  files.LICENSE = project.license?.type || 'UNSPECIFIED';
780
814
  files.mimetype = 'application/vnd.aikdna.kdna+zip';
781
815
 
782
- if (args.includes('--sign')) applySignature(files, option(args, '--passphrase'));
783
- const absOut = path.resolve(out);
784
816
  const entries = [['mimetype', files.mimetype]];
785
817
  for (const name of Object.keys(files).filter(k => k !== 'mimetype').sort()) {
786
818
  entries.push([name, files[name]]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/kdna-studio-cli",
3
- "version": "0.3.3",
3
+ "version": "0.5.0",
4
4
  "description": "Official KDNA Studio command-line authoring entry for creating, locking, compiling, and exporting .kdna judgment assets through the KDNA toolchain.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -41,6 +41,6 @@
41
41
  "@aikdna/kdna-studio-core": "^1.5.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@aikdna/kdna-core": "^0.9.1"
44
+ "@aikdna/kdna-core": "^0.11.0"
45
45
  }
46
46
  }