@aikdna/studio-core 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/pipeline.js +28 -25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aikdna/studio-core",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "KDNA Studio Core — pure logic library for authoring, validating, and compiling KDNA domain judgment packages.",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
package/src/pipeline.js CHANGED
@@ -24,40 +24,23 @@ class StudioPipeline {
24
24
  this.results = {};
25
25
  }
26
26
 
27
- validateProject() {
28
- const r = validateProject(this.project);
29
- this.results.project_valid = r;
30
- return this;
31
- }
32
-
33
- validateCards() {
34
- const issues = validateAllCards(this.project);
35
- this.results.card_validation = { total: issues.length, issues };
36
- return this;
37
- }
38
-
39
- computeReadiness() {
40
- const r = computeReadiness(this.project);
41
- this.results.readiness = r;
42
- return this;
43
- }
44
-
27
+ validateProject() { this.results.project_valid = validateProject(this.project); return this; }
28
+ validateCards() { this.results.card_validation = { total: validateAllCards(this.project).length, issues: validateAllCards(this.project) }; return this; }
29
+ computeReadiness() { this.results.readiness = computeReadiness(this.project); return this; }
30
+
45
31
  compile() {
46
- const r = compileDomain(this.project);
47
- this.results.compile = r;
32
+ this.results.compile = compileDomain(this.project);
48
33
  return this;
49
34
  }
50
35
 
51
36
  generateReadme(readmeOptions = {}) {
52
- const r = generateReadme(this.project, readmeOptions);
53
- this.results.readme = r;
37
+ this.results.readme = generateReadme(this.project, readmeOptions);
54
38
  return this;
55
39
  }
56
40
 
57
41
  buildProvenance() {
58
42
  if (!this.results.compile) throw new Error('Must call compile() before buildProvenance()');
59
- const r = buildProvenance(this.project, this.results.compile.files);
60
- this.results.provenance = r;
43
+ this.results.provenance = buildProvenance(this.project, this.results.compile.files);
61
44
  return this;
62
45
  }
63
46
 
@@ -68,14 +51,21 @@ class StudioPipeline {
68
51
  this.compile();
69
52
  if (options.generateReadme !== false) this.generateReadme(options.readmeOptions);
70
53
  if (options.buildProvenance !== false) this.buildProvenance();
71
- return this.toResult();
54
+ return this;
72
55
  }
73
56
 
57
+ // ── Getters ─────────────────────────────────────────────────────
58
+
59
+ /** @deprecated Use .readiness instead */
74
60
  get readyness() { return this.results.readiness; }
61
+ get readiness() { return this.results.readiness; }
75
62
  get compiled() { return this.results.compile; }
76
63
  get kdnaFiles() { return this.results.compile?.files || {}; }
77
64
  get isPublishable() { return this.results.readiness?.publishable === true; }
78
65
 
66
+ // ── Output methods ──────────────────────────────────────────────
67
+
68
+ /** Flat summary for UI display */
79
69
  toResult() {
80
70
  return {
81
71
  project_valid: this.results.project_valid?.valid === true,
@@ -93,6 +83,19 @@ class StudioPipeline {
93
83
  next_step: this.results.readiness?.next_step || '',
94
84
  };
95
85
  }
86
+
87
+ /** Full artifacts: files + readme + provenance + summary */
88
+ toArtifacts() {
89
+ const result = this.toResult();
90
+ return {
91
+ ...result,
92
+ files: this.results.compile?.files || {},
93
+ readme: this.results.readme || '',
94
+ provenance: this.results.provenance || null,
95
+ readiness_raw: this.results.readiness || null,
96
+ card_validation_raw: this.results.card_validation || null,
97
+ };
98
+ }
96
99
  }
97
100
 
98
101
  module.exports = { createStudioPipeline };