@principal-ai/principal-view-cli 0.1.33 → 0.1.34

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.
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/narrative/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,qBAAqB,IAAI,OAAO,CA6J/C"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/commands/narrative/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,wBAAgB,qBAAqB,IAAI,OAAO,CA0K/C"}
@@ -1,6 +1,7 @@
1
1
  import { Command } from 'commander';
2
2
  import chalk from 'chalk';
3
3
  import { resolve, dirname } from 'node:path';
4
+ import { readFileSync } from 'node:fs';
4
5
  import { NarrativeValidator } from '@principal-ai/principal-view-core';
5
6
  import { loadNarrative, resolvePath } from './utils.js';
6
7
  export function createValidateCommand() {
@@ -20,6 +21,7 @@ export function createValidateCommand() {
20
21
  const narrative = await loadNarrative(narrativePath);
21
22
  // Resolve canvas path
22
23
  let canvasPath;
24
+ let canvas;
23
25
  if (options.canvas) {
24
26
  canvasPath = resolvePath(options.canvas, baseDir);
25
27
  }
@@ -27,6 +29,17 @@ export function createValidateCommand() {
27
29
  const narrativeDir = dirname(narrativePath);
28
30
  canvasPath = resolve(narrativeDir, narrative.canvas);
29
31
  }
32
+ // Load canvas if path exists
33
+ if (canvasPath) {
34
+ try {
35
+ const canvasContent = readFileSync(canvasPath, 'utf-8');
36
+ canvas = JSON.parse(canvasContent);
37
+ }
38
+ catch (error) {
39
+ // Canvas not found or invalid - will be flagged by validator
40
+ canvas = undefined;
41
+ }
42
+ }
30
43
  // Create validator
31
44
  const validator = new NarrativeValidator();
32
45
  // Validate
@@ -34,6 +47,7 @@ export function createValidateCommand() {
34
47
  narrative,
35
48
  narrativePath,
36
49
  canvasPath,
50
+ canvas,
37
51
  basePath: baseDir,
38
52
  };
39
53
  const result = await validator.validate(context);
package/dist/index.cjs CHANGED
@@ -242130,6 +242130,7 @@ function createCoverageCommand() {
242130
242130
 
242131
242131
  // src/commands/narrative/validate.ts
242132
242132
  var import_node_path15 = require("node:path");
242133
+ var import_node_fs12 = require("node:fs");
242133
242134
 
242134
242135
  // src/commands/narrative/utils.ts
242135
242136
  var import_promises4 = require("node:fs/promises");
@@ -242266,17 +242267,27 @@ function createValidateCommand2() {
242266
242267
  const narrativePath = resolvePath(file, baseDir);
242267
242268
  const narrative = await loadNarrative(narrativePath);
242268
242269
  let canvasPath;
242270
+ let canvas;
242269
242271
  if (options.canvas) {
242270
242272
  canvasPath = resolvePath(options.canvas, baseDir);
242271
242273
  } else if (narrative.canvas) {
242272
242274
  const narrativeDir = (0, import_node_path15.dirname)(narrativePath);
242273
242275
  canvasPath = (0, import_node_path15.resolve)(narrativeDir, narrative.canvas);
242274
242276
  }
242277
+ if (canvasPath) {
242278
+ try {
242279
+ const canvasContent = (0, import_node_fs12.readFileSync)(canvasPath, "utf-8");
242280
+ canvas = JSON.parse(canvasContent);
242281
+ } catch (error) {
242282
+ canvas = void 0;
242283
+ }
242284
+ }
242275
242285
  const validator = new NarrativeValidator();
242276
242286
  const context = {
242277
242287
  narrative,
242278
242288
  narrativePath,
242279
242289
  canvasPath,
242290
+ canvas,
242280
242291
  basePath: baseDir
242281
242292
  };
242282
242293
  const result = await validator.validate(context);
@@ -242875,7 +242886,7 @@ function createNarrativeCommand() {
242875
242886
  }
242876
242887
 
242877
242888
  // src/index.ts
242878
- var VERSION2 = "0.1.33";
242889
+ var VERSION2 = "0.1.34";
242879
242890
  var program2 = new Command();
242880
242891
  program2.name("privu").description("Principal View CLI - Validate and manage .canvas configuration files").version(VERSION2);
242881
242892
  program2.addCommand(createInitCommand());