@principal-ai/principal-view-cli 0.1.19 → 0.1.21

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/README.md CHANGED
@@ -37,6 +37,7 @@ vv validate --json # Output as JSON
37
37
  ```
38
38
 
39
39
  **Validation checks:**
40
+
40
41
  - Required `vv` extension with name and version
41
42
  - All nodes have required fields (id, type, x, y, width, height)
42
43
  - Custom node types must have `vv.nodeType` and valid `vv.shape`
@@ -96,18 +97,22 @@ Canvas files follow the [JSON Canvas](https://jsoncanvas.org/) specification wit
96
97
  ### Node Types
97
98
 
98
99
  **Standard types** (no additional metadata required):
100
+
99
101
  - `text` - Text content
100
102
  - `group` - Container for other nodes
101
103
  - `file` - File reference
102
104
  - `link` - URL link
103
105
 
104
106
  **Custom types** require `vv` extension:
107
+
105
108
  ```json
106
109
  {
107
110
  "id": "node-1",
108
111
  "type": "custom",
109
- "x": 0, "y": 0,
110
- "width": 200, "height": 100,
112
+ "x": 0,
113
+ "y": 0,
114
+ "width": 200,
115
+ "height": 100,
111
116
  "vv": {
112
117
  "nodeType": "service",
113
118
  "shape": "rectangle"
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,mBAAmB,IAAI,OAAO,CA2C7C"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,mBAAmB,IAAI,OAAO,CAkD7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+KpC,wBAAgB,mBAAmB,IAAI,OAAO,CAgK7C"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmLpC,wBAAgB,mBAAmB,IAAI,OAAO,CAsK7C"}
@@ -184,21 +184,21 @@ export function createDoctorCommand() {
184
184
  // Filter issues based on options
185
185
  const filterIssues = (issues) => {
186
186
  if (options.errorsOnly) {
187
- return issues.filter(i => i.type === 'error');
187
+ return issues.filter((i) => i.type === 'error');
188
188
  }
189
189
  if (options.quiet) {
190
- return issues.filter(i => i.type === 'error' || i.type === 'warning');
190
+ return issues.filter((i) => i.type === 'error' || i.type === 'warning');
191
191
  }
192
192
  return issues;
193
193
  };
194
194
  // Count issues
195
- const allIssues = results.flatMap(r => filterIssues(r.issues));
196
- const errorCount = allIssues.filter(i => i.type === 'error').length;
197
- const warningCount = allIssues.filter(i => i.type === 'warning').length;
195
+ const allIssues = results.flatMap((r) => filterIssues(r.issues));
196
+ const errorCount = allIssues.filter((i) => i.type === 'error').length;
197
+ const warningCount = allIssues.filter((i) => i.type === 'warning').length;
198
198
  // Output results
199
199
  if (options.json) {
200
200
  console.log(JSON.stringify({
201
- results: results.map(r => ({
201
+ results: results.map((r) => ({
202
202
  ...r,
203
203
  issues: filterIssues(r.issues),
204
204
  })),
@@ -221,7 +221,7 @@ export function createDoctorCommand() {
221
221
  continue;
222
222
  }
223
223
  if (issues.length > 0) {
224
- const hasErrors = issues.some(i => i.type === 'error');
224
+ const hasErrors = issues.some((i) => i.type === 'error');
225
225
  const icon = hasErrors ? chalk.red('✗') : chalk.yellow('⚠');
226
226
  console.log(`${icon} ${result.configFile}` + chalk.dim(` (${result.configName})`));
227
227
  for (const issue of issues) {
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0NpC,wBAAgB,kBAAkB,IAAI,OAAO,CA6F5C"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4NpC,wBAAgB,kBAAkB,IAAI,OAAO,CA+F5C"}
@@ -113,7 +113,7 @@ function addVVHook(repoPath) {
113
113
  const vvContent = getVVHookContent();
114
114
  if (existsSync(hookPath)) {
115
115
  // Append to existing hook
116
- let existingContent = readFileSync(hookPath, 'utf8');
116
+ const existingContent = readFileSync(hookPath, 'utf8');
117
117
  // Check if already has PV hook
118
118
  if (existingContent.includes(VV_HOOK_MARKER)) {
119
119
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkIpC,wBAAgB,iBAAiB,IAAI,OAAO,CAoK3C"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkIpC,wBAAgB,iBAAiB,IAAI,OAAO,CA6L3C"}
@@ -198,12 +198,14 @@ edgeComponents: {}
198
198
  if (existsSync(preCommitFile)) {
199
199
  // Check if our hook is already in the file
200
200
  const existingContent = readFileSync(preCommitFile, 'utf8');
201
- if (existingContent.includes('principal-view-cli lint') || existingContent.includes('privu lint')) {
201
+ if (existingContent.includes('principal-view-cli lint') ||
202
+ existingContent.includes('privu lint')) {
202
203
  console.log(chalk.yellow(`Husky pre-commit hook already includes principal view linting`));
203
204
  }
204
205
  else {
205
206
  // Append our lint command to existing pre-commit
206
- const updatedContent = existingContent.trimEnd() + '\n\n# Run principal view linting\nnpx @principal-ai/principal-view-cli lint --quiet\n';
207
+ const updatedContent = existingContent.trimEnd() +
208
+ '\n\n# Run principal view linting\nnpx @principal-ai/principal-view-cli lint --quiet\n';
207
209
  writeFileSync(preCommitFile, updatedContent);
208
210
  console.log(chalk.green(`Updated Husky pre-commit hook with principal view linting`));
209
211
  huskySetup = true;
@@ -1 +1 @@
1
- {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8PpC,wBAAgB,iBAAiB,IAAI,OAAO,CA8K3C"}
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../src/commands/lint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0PpC,wBAAgB,iBAAiB,IAAI,OAAO,CA8L3C"}
@@ -14,11 +14,7 @@ import { createDefaultRulesEngine, validatePrivuConfig, mergeConfigs, getDefault
14
14
  /**
15
15
  * Config file names in resolution order
16
16
  */
17
- const CONFIG_FILE_NAMES = [
18
- '.privurc.yaml',
19
- '.privurc.yml',
20
- '.privurc.json',
21
- ];
17
+ const CONFIG_FILE_NAMES = ['.privurc.yaml', '.privurc.yml', '.privurc.json'];
22
18
  /**
23
19
  * Find and load privurc config file
24
20
  */
@@ -277,7 +273,11 @@ export function createLintCommand() {
277
273
  patterns = privuConfig.include;
278
274
  }
279
275
  else {
280
- patterns = ['.principal-views/**/*.yaml', '.principal-views/**/*.yml', '.principal-views/**/*.json'];
276
+ patterns = [
277
+ '.principal-views/**/*.yaml',
278
+ '.principal-views/**/*.yml',
279
+ '.principal-views/**/*.json',
280
+ ];
281
281
  }
282
282
  // Find matching files
283
283
  const matchedFiles = await globby(patterns, {
@@ -294,7 +294,10 @@ export function createLintCommand() {
294
294
  });
295
295
  if (configFiles.length === 0) {
296
296
  if (options.json) {
297
- console.log(JSON.stringify({ files: [], summary: { totalFiles: 0, totalErrors: 0, totalWarnings: 0, totalFixable: 0 } }));
297
+ console.log(JSON.stringify({
298
+ files: [],
299
+ summary: { totalFiles: 0, totalErrors: 0, totalWarnings: 0, totalFixable: 0 },
300
+ }));
298
301
  }
299
302
  else {
300
303
  console.log(chalk.yellow('No configuration files found matching the specified patterns.'));
@@ -323,14 +326,16 @@ export function createLintCommand() {
323
326
  if (!loaded) {
324
327
  // File couldn't be loaded - report as error
325
328
  results.set(relativePath, {
326
- violations: [{
329
+ violations: [
330
+ {
327
331
  ruleId: 'parse-error',
328
332
  severity: 'error',
329
333
  file: relativePath,
330
334
  message: `Could not parse file: ${filePath}`,
331
335
  impact: 'File cannot be validated',
332
336
  fixable: false,
333
- }],
337
+ },
338
+ ],
334
339
  errorCount: 1,
335
340
  warningCount: 0,
336
341
  fixableCount: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/commands/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2TpC,wBAAgB,mBAAmB,IAAI,OAAO,CA0B7C"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/commands/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8UpC,wBAAgB,mBAAmB,IAAI,OAAO,CA0B7C"}
@@ -96,10 +96,10 @@ ${chalk.bold('Required Fields:')}
96
96
  ${chalk.green('id')} ${chalk.dim('string')} Unique identifier
97
97
  ${chalk.green('fromNode')} ${chalk.dim('string')} Source node ID
98
98
  ${chalk.green('toNode')} ${chalk.dim('string')} Target node ID
99
-
100
- ${chalk.bold('Optional Fields:')}
101
99
  ${chalk.green('fromSide')} ${chalk.dim('string')} Side of source: top, right, bottom, left
102
100
  ${chalk.green('toSide')} ${chalk.dim('string')} Side of target: top, right, bottom, left
101
+
102
+ ${chalk.bold('Optional Fields:')}
103
103
  ${chalk.green('fromEnd')} ${chalk.dim('string')} Source endpoint: none, arrow
104
104
  ${chalk.green('toEnd')} ${chalk.dim('string')} Target endpoint: none, arrow (default)
105
105
  ${chalk.green('color')} ${chalk.dim('string')} Edge color (hex or preset)
@@ -109,6 +109,7 @@ ${chalk.bold('PV Edge Extension:')}
109
109
  ${chalk.dim('{')}
110
110
  ${chalk.green('"id"')}: "edge-1",
111
111
  ${chalk.green('"fromNode"')}: "api", ${chalk.green('"toNode"')}: "db",
112
+ ${chalk.green('"fromSide"')}: "right", ${chalk.green('"toSide"')}: "left",
112
113
  ${chalk.green('"pv"')}: {
113
114
  ${chalk.yellow('"edgeType"')}: "query" ${chalk.dim('// Must be defined in vv.edgeTypes')}
114
115
  }
@@ -286,6 +287,8 @@ ${chalk.dim('─'.repeat(50))}
286
287
  "id": "api-to-db",
287
288
  "fromNode": "api",
288
289
  "toNode": "db",
290
+ "fromSide": "right",
291
+ "toSide": "left",
289
292
  "pv": { "edgeType": "query" }
290
293
  }
291
294
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgpBpC,wBAAgB,qBAAqB,IAAI,OAAO,CAyG/C"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAshCpC,wBAAgB,qBAAqB,IAAI,OAAO,CAsH/C"}