@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.
- package/dist/commands/formats.d.ts.map +1 -1
- package/dist/commands/formats.js +15 -23
- package/dist/index.cjs +49 -23
- package/dist/index.cjs.map +2 -2
- package/package.json +2 -2
|
@@ -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;
|
|
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"}
|
package/dist/commands/formats.js
CHANGED
|
@@ -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"')}: "
|
|
134
|
-
${chalk.dim('│')} ${chalk.cyan('"
|
|
135
|
-
${chalk.dim('│')} "
|
|
136
|
-
${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": "
|
|
409
|
-
"
|
|
410
|
-
"
|
|
411
|
-
"
|
|
412
|
-
|
|
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": "
|
|
422
|
-
"
|
|
423
|
-
"
|
|
424
|
-
"
|
|
425
|
-
|
|
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": "
|
|
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"')}: "
|
|
247725
|
-
${source_default.dim("\u2502")} ${source_default.cyan('"
|
|
247726
|
-
${source_default.dim("\u2502")} "
|
|
247727
|
-
${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": "
|
|
248000
|
-
"
|
|
248001
|
-
"
|
|
248002
|
-
"
|
|
248003
|
-
|
|
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": "
|
|
248013
|
-
"
|
|
248014
|
-
"
|
|
248015
|
-
"
|
|
248016
|
-
|
|
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": "
|
|
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
|
]
|