@principal-ai/principal-view-cli 0.4.1 → 0.4.3

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":"formats.d.ts","sourceRoot":"","sources":["../../src/commands/formats.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+fpC,wBAAgB,oBAAoB,IAAI,OAAO,CA6B9C"}
1
+ {"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../../src/commands/formats.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAufpC,wBAAgB,oBAAoB,IAAI,OAAO,CA6B9C"}
@@ -130,11 +130,10 @@ ${chalk.dim('│')} {
130
130
  ${chalk.dim('│')} ${chalk.yellow('"priority"')}: 1, ${chalk.dim('// Lower = higher priority')} ${chalk.dim('│')}
131
131
  ${chalk.dim('│')} ${chalk.yellow('"condition"')}: "...", ${chalk.dim('// JSONPath/logic expression')} ${chalk.dim('│')}
132
132
  ${chalk.dim('│')} ${chalk.yellow('"template"')}: { ${chalk.dim('// Narrative template')} ${chalk.dim('│')}
133
- ${chalk.dim('│')} ${chalk.cyan('"summary"')}: "...", ${chalk.dim('// One-line summary')} ${chalk.dim('│')}
134
- ${chalk.dim('│')} ${chalk.cyan('"details"')}: [ ${chalk.dim('// Step-by-step details')} ${chalk.dim('│')}
135
- ${chalk.dim('│')} "Step 1: ...", ${chalk.dim('│')}
136
- ${chalk.dim('│')} "Step 2: ...", ${chalk.dim('│')}
137
- ${chalk.dim('│')} ] ${chalk.dim('│')}
133
+ ${chalk.dim('│')} ${chalk.cyan('"summary"')}: "Completed {{count}} items", ${chalk.dim('// Handlebars template')} ${chalk.dim('│')}
134
+ ${chalk.dim('│')} ${chalk.cyan('"events"')}: { ${chalk.dim('// Per-event templates')} ${chalk.dim('│')}
135
+ ${chalk.dim('│')} "event.name": "Event {{attribute}} occurred" ${chalk.dim('│')}
136
+ ${chalk.dim('│')} } ${chalk.dim('│')}
138
137
  ${chalk.dim('│')} } ${chalk.dim('│')}
139
138
  ${chalk.dim('│')} } ${chalk.dim('│')}
140
139
  ${chalk.dim('│')} ] ${chalk.dim('│')}
@@ -405,36 +404,29 @@ ${chalk.yellow('.principal-views/data-validator.narrative.json')}
405
404
  "priority": 1,
406
405
  "condition": "events[?name=='validation.complete']",
407
406
  "template": {
408
- "summary": "Validated {{result.validCount}} records successfully",
409
- "details": [
410
- "🔍 Started validation",
411
- "📊 Processed {{input.recordCount}} records",
412
- "✅ {{result.validCount}} valid",
413
- "❌ {{result.invalidCount}} invalid"
414
- ]
407
+ "summary": "Validated {{result.validCount}} records successfully",
408
+ "events": {
409
+ "validation.started": "Started validation of {{input.recordCount}} records",
410
+ "validation.complete": "Processed {{result.validCount}} valid and {{result.invalidCount}} invalid records"
411
+ }
415
412
  }
416
413
  },
417
414
  {
418
415
  "priority": 2,
419
416
  "condition": "events[?name=='validation.error']",
420
417
  "template": {
421
- "summary": "Validation failed: {{error.message}}",
422
- "details": [
423
- "🔍 Started validation",
424
- "💥 Error occurred: {{error.message}}",
425
- "🏷️ Error type: {{error.type}}"
426
- ]
418
+ "summary": "Validation failed: {{error.message}}",
419
+ "events": {
420
+ "validation.started": "Started validation",
421
+ "validation.error": "Error occurred: {{error.message}} (type: {{error.type}})"
422
+ }
427
423
  }
428
424
  },
429
425
  {
430
426
  "priority": 999,
431
427
  "condition": "true",
432
428
  "template": {
433
- "summary": "📋 Validation execution captured",
434
- "details": [
435
- "📦 Captured {{spans.length}} events",
436
- "⏱️ Duration: {{duration.ms}}ms"
437
- ]
429
+ "summary": "Validation execution captured ({{spans.length}} events, {{duration.ms}}ms)"
438
430
  }
439
431
  }
440
432
  ]
package/dist/index.cjs CHANGED
@@ -241935,6 +241935,40 @@ var NarrativeValidator = class {
241935
241935
  const violations = [];
241936
241936
  const validFields = ["introduction", "events", "logs", "flow", "summary", "span", "children"];
241937
241937
  const templateKeys = Object.keys(template);
241938
+ if (!template.events) {
241939
+ violations.push({
241940
+ ruleId: "narrative-template-structure",
241941
+ severity: "error",
241942
+ file,
241943
+ path: `scenarios[${scenarioIdx}].template`,
241944
+ message: 'Template is missing required "events" field',
241945
+ impact: "Template must specify how to render each event type",
241946
+ suggestion: 'Add "events: { eventName: template }" to map event names to templates',
241947
+ fixable: false
241948
+ });
241949
+ } else if (typeof template.events !== "object" || Array.isArray(template.events)) {
241950
+ violations.push({
241951
+ ruleId: "narrative-template-structure",
241952
+ severity: "error",
241953
+ file,
241954
+ path: `scenarios[${scenarioIdx}].template.events`,
241955
+ message: 'Template "events" field must be an object',
241956
+ impact: "Events will not render correctly",
241957
+ suggestion: 'Use object format: { "event.name": "template string" }',
241958
+ fixable: false
241959
+ });
241960
+ } else if (Object.keys(template.events).length === 0) {
241961
+ violations.push({
241962
+ ruleId: "narrative-template-structure",
241963
+ severity: "error",
241964
+ file,
241965
+ path: `scenarios[${scenarioIdx}].template.events`,
241966
+ message: 'Template "events" field must not be empty',
241967
+ impact: "No events will be rendered in this scenario",
241968
+ suggestion: 'Add at least one event template: { "event.name": "template string" }',
241969
+ fixable: false
241970
+ });
241971
+ }
241938
241972
  for (const key of templateKeys) {
241939
241973
  if (!validFields.includes(key)) {
241940
241974
  if (key === "steps") {
@@ -247721,11 +247755,10 @@ ${source_default.dim("\u2502")} {
247721
247755
  ${source_default.dim("\u2502")} ${source_default.yellow('"priority"')}: 1, ${source_default.dim("// Lower = higher priority")} ${source_default.dim("\u2502")}
247722
247756
  ${source_default.dim("\u2502")} ${source_default.yellow('"condition"')}: "...", ${source_default.dim("// JSONPath/logic expression")} ${source_default.dim("\u2502")}
247723
247757
  ${source_default.dim("\u2502")} ${source_default.yellow('"template"')}: { ${source_default.dim("// Narrative template")} ${source_default.dim("\u2502")}
247724
- ${source_default.dim("\u2502")} ${source_default.cyan('"summary"')}: "...", ${source_default.dim("// One-line summary")} ${source_default.dim("\u2502")}
247725
- ${source_default.dim("\u2502")} ${source_default.cyan('"details"')}: [ ${source_default.dim("// Step-by-step details")} ${source_default.dim("\u2502")}
247726
- ${source_default.dim("\u2502")} "Step 1: ...", ${source_default.dim("\u2502")}
247727
- ${source_default.dim("\u2502")} "Step 2: ...", ${source_default.dim("\u2502")}
247728
- ${source_default.dim("\u2502")} ] ${source_default.dim("\u2502")}
247758
+ ${source_default.dim("\u2502")} ${source_default.cyan('"summary"')}: "Completed {{count}} items", ${source_default.dim("// Handlebars template")} ${source_default.dim("\u2502")}
247759
+ ${source_default.dim("\u2502")} ${source_default.cyan('"events"')}: { ${source_default.dim("// Per-event templates")} ${source_default.dim("\u2502")}
247760
+ ${source_default.dim("\u2502")} "event.name": "Event {{attribute}} occurred" ${source_default.dim("\u2502")}
247761
+ ${source_default.dim("\u2502")} } ${source_default.dim("\u2502")}
247729
247762
  ${source_default.dim("\u2502")} } ${source_default.dim("\u2502")}
247730
247763
  ${source_default.dim("\u2502")} } ${source_default.dim("\u2502")}
247731
247764
  ${source_default.dim("\u2502")} ] ${source_default.dim("\u2502")}
@@ -247996,36 +248029,29 @@ ${source_default.yellow(".principal-views/data-validator.narrative.json")}
247996
248029
  "priority": 1,
247997
248030
  "condition": "events[?name=='validation.complete']",
247998
248031
  "template": {
247999
- "summary": "\u2705 Validated {{result.validCount}} records successfully",
248000
- "details": [
248001
- "\u{1F50D} Started validation",
248002
- "\u{1F4CA} Processed {{input.recordCount}} records",
248003
- "\u2705 {{result.validCount}} valid",
248004
- "\u274C {{result.invalidCount}} invalid"
248005
- ]
248032
+ "summary": "Validated {{result.validCount}} records successfully",
248033
+ "events": {
248034
+ "validation.started": "Started validation of {{input.recordCount}} records",
248035
+ "validation.complete": "Processed {{result.validCount}} valid and {{result.invalidCount}} invalid records"
248036
+ }
248006
248037
  }
248007
248038
  },
248008
248039
  {
248009
248040
  "priority": 2,
248010
248041
  "condition": "events[?name=='validation.error']",
248011
248042
  "template": {
248012
- "summary": "\u274C Validation failed: {{error.message}}",
248013
- "details": [
248014
- "\u{1F50D} Started validation",
248015
- "\u{1F4A5} Error occurred: {{error.message}}",
248016
- "\u{1F3F7}\uFE0F Error type: {{error.type}}"
248017
- ]
248043
+ "summary": "Validation failed: {{error.message}}",
248044
+ "events": {
248045
+ "validation.started": "Started validation",
248046
+ "validation.error": "Error occurred: {{error.message}} (type: {{error.type}})"
248047
+ }
248018
248048
  }
248019
248049
  },
248020
248050
  {
248021
248051
  "priority": 999,
248022
248052
  "condition": "true",
248023
248053
  "template": {
248024
- "summary": "\u{1F4CB} Validation execution captured",
248025
- "details": [
248026
- "\u{1F4E6} Captured {{spans.length}} events",
248027
- "\u23F1\uFE0F Duration: {{duration.ms}}ms"
248028
- ]
248054
+ "summary": "Validation execution captured ({{spans.length}} events, {{duration.ms}}ms)"
248029
248055
  }
248030
248056
  }
248031
248057
  ]