@principal-ai/principal-view-cli 0.3.5 → 0.3.7

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/index.cjs CHANGED
@@ -229771,9 +229771,9 @@ ${e.message}`;
229771
229771
  }
229772
229772
  });
229773
229773
 
229774
- // node_modules/ignore/index.js
229774
+ // node_modules/@principal-ai/codebase-composition/node_modules/ignore/index.js
229775
229775
  var require_ignore2 = __commonJS({
229776
- "node_modules/ignore/index.js"(exports2, module2) {
229776
+ "node_modules/@principal-ai/codebase-composition/node_modules/ignore/index.js"(exports2, module2) {
229777
229777
  function makeArray(subject) {
229778
229778
  return Array.isArray(subject) ? subject : [subject];
229779
229779
  }
@@ -241497,11 +241497,12 @@ var NarrativeValidator = class {
241497
241497
  const violations = [];
241498
241498
  violations.push(...this.checkSchema(context));
241499
241499
  violations.push(...this.checkCanvasExists(context));
241500
+ violations.push(...this.checkScenarios(context));
241501
+ violations.push(...this.checkEventNameSyntax(context));
241500
241502
  if (context.canvas) {
241501
241503
  violations.push(...this.checkEventReferences(context));
241502
241504
  violations.push(...this.checkAttributeReferences(context));
241503
241505
  }
241504
- violations.push(...this.checkScenarios(context));
241505
241506
  violations.push(...this.checkTemplateSyntax(context));
241506
241507
  violations.push(...this.checkFormattingOptions(context));
241507
241508
  return this.aggregateResults(violations);
@@ -241938,6 +241939,64 @@ var NarrativeValidator = class {
241938
241939
  }
241939
241940
  return violations;
241940
241941
  }
241942
+ /**
241943
+ * Check that event names don't use attribute filter syntax
241944
+ */
241945
+ checkEventNameSyntax(context) {
241946
+ const violations = [];
241947
+ const { narrative, narrativePath } = context;
241948
+ narrative.scenarios.forEach((scenario, scenarioIdx) => {
241949
+ if (scenario.condition?.requires) {
241950
+ scenario.condition.requires.forEach((eventPattern, idx) => {
241951
+ if (eventPattern.includes("[") && eventPattern.includes("]")) {
241952
+ violations.push({
241953
+ ruleId: "narrative-event-name-syntax",
241954
+ severity: "error",
241955
+ file: narrativePath,
241956
+ path: `scenarios[${scenarioIdx}].condition.requires[${idx}]`,
241957
+ message: `Event name uses unsupported [attribute=value] syntax: "${eventPattern}"`,
241958
+ impact: "Attribute filter syntax is not supported - event will not match",
241959
+ suggestion: `Use a distinct event name instead (e.g., "${this.extractBaseEventName(eventPattern)}.${this.extractAttributeValue(eventPattern)}")`,
241960
+ fixable: false
241961
+ });
241962
+ }
241963
+ });
241964
+ }
241965
+ if (scenario.condition?.excludes) {
241966
+ scenario.condition.excludes.forEach((eventPattern, idx) => {
241967
+ if (eventPattern.includes("[") && eventPattern.includes("]")) {
241968
+ violations.push({
241969
+ ruleId: "narrative-event-name-syntax",
241970
+ severity: "error",
241971
+ file: narrativePath,
241972
+ path: `scenarios[${scenarioIdx}].condition.excludes[${idx}]`,
241973
+ message: `Event name uses unsupported [attribute=value] syntax: "${eventPattern}"`,
241974
+ impact: "Attribute filter syntax is not supported - event will not match",
241975
+ suggestion: `Use a distinct event name instead (e.g., "${this.extractBaseEventName(eventPattern)}.${this.extractAttributeValue(eventPattern)}")`,
241976
+ fixable: false
241977
+ });
241978
+ }
241979
+ });
241980
+ }
241981
+ if (scenario.template?.events) {
241982
+ Object.keys(scenario.template.events).forEach((eventName) => {
241983
+ if (eventName.includes("[") && eventName.includes("]")) {
241984
+ violations.push({
241985
+ ruleId: "narrative-event-name-syntax",
241986
+ severity: "error",
241987
+ file: narrativePath,
241988
+ path: `scenarios[${scenarioIdx}].template.events["${eventName}"]`,
241989
+ message: `Event name uses unsupported [attribute=value] syntax: "${eventName}"`,
241990
+ impact: "Attribute filter syntax is not supported - template will never render",
241991
+ suggestion: `Use a distinct event name instead (e.g., "${this.extractBaseEventName(eventName)}.${this.extractAttributeValue(eventName)}")`,
241992
+ fixable: false
241993
+ });
241994
+ }
241995
+ });
241996
+ }
241997
+ });
241998
+ return violations;
241999
+ }
241941
242000
  /**
241942
242001
  * Check template syntax (balanced braces, valid expressions)
241943
242002
  */
@@ -242130,6 +242189,36 @@ var NarrativeValidator = class {
242130
242189
  const regex = new RegExp(`^${pattern}$`);
242131
242190
  return availableEvents.some((e) => regex.test(e));
242132
242191
  }
242192
+ /**
242193
+ * Extract base event name from event pattern
242194
+ *
242195
+ * Examples:
242196
+ * - "installation.started" -> "installation.started"
242197
+ * - "installation.progress[stage=skills_discovered]" -> "installation.progress"
242198
+ * - "error.*[severity=high]" -> "error.*"
242199
+ */
242200
+ extractBaseEventName(eventPattern) {
242201
+ const bracketIndex = eventPattern.indexOf("[");
242202
+ if (bracketIndex === -1) {
242203
+ return eventPattern;
242204
+ }
242205
+ return eventPattern.substring(0, bracketIndex);
242206
+ }
242207
+ /**
242208
+ * Extract attribute value from event pattern for suggestion
242209
+ *
242210
+ * Examples:
242211
+ * - "installation.progress[stage=skills_discovered]" -> "skills_discovered"
242212
+ * - "error.*[severity=high]" -> "high"
242213
+ * - "installation.started" -> ""
242214
+ */
242215
+ extractAttributeValue(eventPattern) {
242216
+ const match = eventPattern.match(/\[.*?=(.*?)\]/);
242217
+ if (!match) {
242218
+ return "";
242219
+ }
242220
+ return match[1];
242221
+ }
242133
242222
  };
242134
242223
  function createNarrativeValidator() {
242135
242224
  return new NarrativeValidator();