@principal-ai/principal-view-cli 0.1.23 → 0.1.25
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/create.js +2 -2
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/hooks.d.ts +1 -1
- package/dist/commands/hooks.js +10 -10
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +6 -7
- package/dist/commands/list.js +1 -1
- package/dist/commands/schema.js +3 -3
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +19 -31
- package/dist/index.cjs +53 -55
- package/dist/index.cjs.map +2 -2
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -38,8 +38,8 @@ export function createCreateCommand() {
|
|
|
38
38
|
console.log(chalk.bold('Next steps:'));
|
|
39
39
|
console.log(` 1. Open ${chalk.cyan(`.principal-views/${options.name}.canvas`)} in your editor`);
|
|
40
40
|
console.log(` 2. Add nodes and edges to define your architecture`);
|
|
41
|
-
console.log(` 3. Run ${chalk.cyan('
|
|
42
|
-
console.log(` 4. Run ${chalk.cyan('
|
|
41
|
+
console.log(` 3. Run ${chalk.cyan('npx @principal-ai/principal-view-cli validate')} to check your configuration`);
|
|
42
|
+
console.log(` 4. Run ${chalk.cyan('npx @principal-ai/principal-view-cli doctor')} to verify source mappings`);
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
45
|
console.error(chalk.red('Error:'), error.message);
|
package/dist/commands/doctor.js
CHANGED
|
@@ -149,7 +149,7 @@ export function createDoctorCommand() {
|
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
console.log(chalk.yellow('No .principal-views directory found.'));
|
|
152
|
-
console.log(chalk.dim('Run "
|
|
152
|
+
console.log(chalk.dim('Run "npx @principal-ai/principal-view-cli init" to create a configuration.'));
|
|
153
153
|
}
|
|
154
154
|
return;
|
|
155
155
|
}
|
package/dist/commands/hooks.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Hooks command - Manage husky pre-commit hooks for Principal View
|
|
3
3
|
*
|
|
4
4
|
* This command installs/removes pre-commit hooks into a target project
|
|
5
|
-
* that will run `
|
|
5
|
+
* that will run `npx @principal-ai/principal-view-cli doctor` and `npx @principal-ai/principal-view-cli validate` before each commit.
|
|
6
6
|
*/
|
|
7
7
|
import { Command } from 'commander';
|
|
8
8
|
export declare function createHooksCommand(): Command;
|
package/dist/commands/hooks.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Hooks command - Manage husky pre-commit hooks for Principal View
|
|
3
3
|
*
|
|
4
4
|
* This command installs/removes pre-commit hooks into a target project
|
|
5
|
-
* that will run `
|
|
5
|
+
* that will run `npx @principal-ai/principal-view-cli doctor` and `npx @principal-ai/principal-view-cli validate` before each commit.
|
|
6
6
|
*/
|
|
7
7
|
import { Command } from 'commander';
|
|
8
8
|
import { existsSync, readFileSync, writeFileSync, unlinkSync, chmodSync } from 'node:fs';
|
|
@@ -18,17 +18,17 @@ const VV_HOOK_MARKER = '# Principal View checks';
|
|
|
18
18
|
function getVVHookContent() {
|
|
19
19
|
return `${VV_HOOK_MARKER}
|
|
20
20
|
echo "Running Principal View doctor check..."
|
|
21
|
-
npx
|
|
21
|
+
npx @principal-ai/principal-view-cli doctor --errors-only || {
|
|
22
22
|
echo "❌ Principal View doctor check failed (errors found)"
|
|
23
|
-
echo " Run '
|
|
23
|
+
echo " Run 'npx @principal-ai/principal-view-cli doctor' to see details"
|
|
24
24
|
exit 1
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
echo "Running Principal View canvas validation..."
|
|
28
|
-
npx
|
|
28
|
+
npx @principal-ai/principal-view-cli validate --quiet 2>/dev/null || {
|
|
29
29
|
if [ $? -ne 0 ]; then
|
|
30
30
|
echo "❌ Canvas validation failed"
|
|
31
|
-
echo " Run '
|
|
31
|
+
echo " Run 'npx @principal-ai/principal-view-cli validate' to see details"
|
|
32
32
|
exit 1
|
|
33
33
|
fi
|
|
34
34
|
}
|
|
@@ -164,7 +164,7 @@ function removeVVHook(repoPath) {
|
|
|
164
164
|
const line = lines[i];
|
|
165
165
|
// Check if this line is part of the PV block
|
|
166
166
|
if (line &&
|
|
167
|
-
(line.includes('
|
|
167
|
+
(line.includes('@principal-ai/principal-view-cli ') ||
|
|
168
168
|
line.includes('Principal View') ||
|
|
169
169
|
line.includes('echo "Running Visual') ||
|
|
170
170
|
(line.includes('exit 1') && i > startIndex && i < startIndex + 15) ||
|
|
@@ -222,12 +222,12 @@ export function createHooksCommand() {
|
|
|
222
222
|
if (!isHuskyInstalled(repoPath)) {
|
|
223
223
|
if (options.check) {
|
|
224
224
|
console.log(chalk.red('❌ Husky is not installed'));
|
|
225
|
-
console.log(' Run "
|
|
225
|
+
console.log(' Run "npx @principal-ai/principal-view-cli hooks --init" to install husky');
|
|
226
226
|
process.exit(1);
|
|
227
227
|
}
|
|
228
228
|
else if (options.add) {
|
|
229
229
|
console.log(chalk.red('❌ Husky is not installed'));
|
|
230
|
-
console.log(' Run "
|
|
230
|
+
console.log(' Run "npx @principal-ai/principal-view-cli hooks --init" first to install husky');
|
|
231
231
|
process.exit(1);
|
|
232
232
|
}
|
|
233
233
|
else if (options.remove) {
|
|
@@ -237,7 +237,7 @@ export function createHooksCommand() {
|
|
|
237
237
|
else {
|
|
238
238
|
console.log(chalk.red('❌ Husky is not installed in this repository'));
|
|
239
239
|
console.log('\nTo install husky and set up Principal View hooks:');
|
|
240
|
-
console.log('
|
|
240
|
+
console.log(' npx @principal-ai/principal-view-cli hooks --init --add');
|
|
241
241
|
process.exit(1);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
@@ -259,7 +259,7 @@ export function createHooksCommand() {
|
|
|
259
259
|
addVVHook(repoPath);
|
|
260
260
|
console.log(chalk.green('✅ Added Principal View checks to pre-commit hook'));
|
|
261
261
|
console.log('\nPre-commit hook will now:');
|
|
262
|
-
console.log(' • Run
|
|
262
|
+
console.log(' • Run npx @principal-ai/principal-view-cli doctor to check for stale configurations');
|
|
263
263
|
console.log(' • Validate all .canvas files');
|
|
264
264
|
}
|
|
265
265
|
}
|
|
@@ -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;AA+GpC,wBAAgB,iBAAiB,IAAI,OAAO,
|
|
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;AA+GpC,wBAAgB,iBAAiB,IAAI,OAAO,CA4L3C"}
|
package/dist/commands/init.js
CHANGED
|
@@ -180,8 +180,7 @@ edgeComponents: {}
|
|
|
180
180
|
if (existsSync(preCommitFile)) {
|
|
181
181
|
// Check if our hook is already in the file
|
|
182
182
|
const existingContent = readFileSync(preCommitFile, 'utf8');
|
|
183
|
-
if (existingContent.includes('principal-view-cli lint')
|
|
184
|
-
existingContent.includes('privu lint')) {
|
|
183
|
+
if (existingContent.includes('principal-view-cli lint')) {
|
|
185
184
|
console.log(chalk.yellow(`Husky pre-commit hook already includes principal view linting`));
|
|
186
185
|
}
|
|
187
186
|
else {
|
|
@@ -252,16 +251,16 @@ edgeComponents: {}
|
|
|
252
251
|
console.log(chalk.bold('Next steps:'));
|
|
253
252
|
console.log(` 1. Define components in ${chalk.cyan('.principal-views/library.yaml')}`);
|
|
254
253
|
console.log(` 2. Build your graph in ${chalk.cyan(`.principal-views/${options.name}.canvas`)}`);
|
|
255
|
-
console.log(` 3. Run ${chalk.cyan('
|
|
254
|
+
console.log(` 3. Run ${chalk.cyan('npx @principal-ai/principal-view-cli lint')} to validate your configuration`);
|
|
256
255
|
if (huskySetup) {
|
|
257
256
|
console.log(` 4. Commits will now automatically lint .principal-views files`);
|
|
258
257
|
}
|
|
259
258
|
console.log('');
|
|
260
259
|
console.log(chalk.bold('Commands:'));
|
|
261
|
-
console.log(` • ${chalk.cyan('
|
|
262
|
-
console.log(` • ${chalk.cyan('
|
|
263
|
-
console.log(` • ${chalk.cyan('
|
|
264
|
-
console.log(` • ${chalk.cyan('
|
|
260
|
+
console.log(` • ${chalk.cyan('npx @principal-ai/principal-view-cli lint')} - Lint configuration files`);
|
|
261
|
+
console.log(` • ${chalk.cyan('npx @principal-ai/principal-view-cli lint --json')} - Output lint results as JSON`);
|
|
262
|
+
console.log(` • ${chalk.cyan('npx @principal-ai/principal-view-cli validate')} - Validate canvas files`);
|
|
263
|
+
console.log(` • ${chalk.cyan('npx @principal-ai/principal-view-cli doctor')} - Check project setup`);
|
|
265
264
|
}
|
|
266
265
|
catch (error) {
|
|
267
266
|
console.error(chalk.red('Error:'), error.message);
|
package/dist/commands/list.js
CHANGED
|
@@ -49,7 +49,7 @@ export function createListCommand() {
|
|
|
49
49
|
if (!options.all) {
|
|
50
50
|
console.log(chalk.dim('Run with --all to search all directories'));
|
|
51
51
|
}
|
|
52
|
-
console.log(chalk.dim('\nTo create a new canvas, run:
|
|
52
|
+
console.log(chalk.dim('\nTo create a new canvas, run: npx @principal-ai/principal-view-cli init'));
|
|
53
53
|
}
|
|
54
54
|
return;
|
|
55
55
|
}
|
package/dist/commands/schema.js
CHANGED
|
@@ -24,7 +24,7 @@ ${chalk.dim('│')} } ${chalk.dim(
|
|
|
24
24
|
${chalk.dim('│')} } ${chalk.dim('│')}
|
|
25
25
|
${chalk.dim('└─────────────────────────────────────────────────┘')}
|
|
26
26
|
|
|
27
|
-
Run ${chalk.cyan('
|
|
27
|
+
Run ${chalk.cyan('npx @principal-ai/principal-view-cli schema <section>')} for details on:
|
|
28
28
|
${chalk.yellow('nodes')} Node types and properties
|
|
29
29
|
${chalk.yellow('edges')} Edge properties and types
|
|
30
30
|
${chalk.yellow('vv')} Principal View extension fields
|
|
@@ -309,8 +309,8 @@ ${chalk.dim('─'.repeat(50))}
|
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
${chalk.bold('Run validation:')} ${chalk.cyan('
|
|
313
|
-
${chalk.bold('Initialize project:')} ${chalk.cyan('
|
|
312
|
+
${chalk.bold('Run validation:')} ${chalk.cyan('npx @principal-ai/principal-view-cli validate <file>')}
|
|
313
|
+
${chalk.bold('Initialize project:')} ${chalk.cyan('npx @principal-ai/principal-view-cli init')}
|
|
314
314
|
`,
|
|
315
315
|
};
|
|
316
316
|
export function createSchemaCommand() {
|
|
@@ -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;
|
|
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;AAgjCpC,wBAAgB,qBAAqB,IAAI,OAAO,CAsH/C"}
|
|
@@ -182,7 +182,17 @@ function validateIconName(iconValue, path, issues) {
|
|
|
182
182
|
*/
|
|
183
183
|
const ALLOWED_CANVAS_FIELDS = {
|
|
184
184
|
root: ['nodes', 'edges', 'pv'],
|
|
185
|
-
pv: [
|
|
185
|
+
pv: [
|
|
186
|
+
'version',
|
|
187
|
+
'name',
|
|
188
|
+
'description',
|
|
189
|
+
'nodeTypes',
|
|
190
|
+
'edgeTypes',
|
|
191
|
+
'pathConfig',
|
|
192
|
+
'display',
|
|
193
|
+
'scope',
|
|
194
|
+
'audit',
|
|
195
|
+
],
|
|
186
196
|
pvPathConfig: [
|
|
187
197
|
'projectRoot',
|
|
188
198
|
'captureSource',
|
|
@@ -540,37 +550,15 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
540
550
|
suggestion: 'Add a "url" field with a URL, or change the node type',
|
|
541
551
|
});
|
|
542
552
|
}
|
|
543
|
-
// Validate node type - must be standard
|
|
553
|
+
// Validate node type - must be a standard JSON Canvas type
|
|
544
554
|
const isStandardType = STANDARD_CANVAS_TYPES.includes(nodeType);
|
|
545
555
|
if (!isStandardType) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
suggestion: `Use a standard type (${STANDARD_CANVAS_TYPES.join(', ')}) or add pv.nodeType and pv.shape`,
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
const nodePv = n.pv;
|
|
557
|
-
if (typeof nodePv.nodeType !== 'string' || !nodePv.nodeType) {
|
|
558
|
-
issues.push({
|
|
559
|
-
type: 'error',
|
|
560
|
-
message: `Node "${n.id || index}" with custom type must have "pv.nodeType"`,
|
|
561
|
-
path: `nodes[${index}].pv.nodeType`,
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
if (typeof nodePv.shape !== 'string' ||
|
|
565
|
-
!VALID_NODE_SHAPES.includes(nodePv.shape)) {
|
|
566
|
-
issues.push({
|
|
567
|
-
type: 'error',
|
|
568
|
-
message: `Node "${n.id || index}" must have a valid "pv.shape"`,
|
|
569
|
-
path: `nodes[${index}].pv.shape`,
|
|
570
|
-
suggestion: `Valid shapes: ${VALID_NODE_SHAPES.join(', ')}`,
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
}
|
|
556
|
+
issues.push({
|
|
557
|
+
type: 'error',
|
|
558
|
+
message: `Node "${n.id || index}" uses invalid type "${nodeType}"`,
|
|
559
|
+
path: `nodes[${index}].type`,
|
|
560
|
+
suggestion: `Use a standard JSON Canvas type (${STANDARD_CANVAS_TYPES.join(', ')}). For custom shapes, use type: "text" with pv.shape: "${nodeType}"`,
|
|
561
|
+
});
|
|
574
562
|
}
|
|
575
563
|
// Validate node pv extension fields
|
|
576
564
|
if (n.pv && typeof n.pv === 'object') {
|
|
@@ -860,7 +848,7 @@ export function createValidateCommand() {
|
|
|
860
848
|
else {
|
|
861
849
|
console.log(chalk.yellow('No .canvas files found matching the specified patterns.'));
|
|
862
850
|
console.log(chalk.dim(`Patterns searched: ${patterns.join(', ')}`));
|
|
863
|
-
console.log(chalk.dim('\nTo create a new .principal-views folder, run:
|
|
851
|
+
console.log(chalk.dim('\nTo create a new .principal-views folder, run: npx @principal-ai/principal-view-cli init'));
|
|
864
852
|
}
|
|
865
853
|
return;
|
|
866
854
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -13511,7 +13511,11 @@ function validateLibrary(library) {
|
|
|
13511
13511
|
issues
|
|
13512
13512
|
);
|
|
13513
13513
|
const state = stateDef;
|
|
13514
|
-
validateIconName(
|
|
13514
|
+
validateIconName(
|
|
13515
|
+
state.icon,
|
|
13516
|
+
`nodeComponents.${compId}.states.${stateId}.icon`,
|
|
13517
|
+
issues
|
|
13518
|
+
);
|
|
13515
13519
|
}
|
|
13516
13520
|
}
|
|
13517
13521
|
}
|
|
@@ -13605,7 +13609,6 @@ function validateLibrary(library) {
|
|
|
13605
13609
|
return issues;
|
|
13606
13610
|
}
|
|
13607
13611
|
var STANDARD_CANVAS_TYPES = ["text", "group", "file", "link"];
|
|
13608
|
-
var VALID_NODE_SHAPES = ["circle", "rectangle", "hexagon", "diamond", "custom"];
|
|
13609
13612
|
function kebabToPascalCase(str2) {
|
|
13610
13613
|
return str2.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join("");
|
|
13611
13614
|
}
|
|
@@ -13638,7 +13641,17 @@ function validateIconName(iconValue, path4, issues) {
|
|
|
13638
13641
|
}
|
|
13639
13642
|
var ALLOWED_CANVAS_FIELDS = {
|
|
13640
13643
|
root: ["nodes", "edges", "pv"],
|
|
13641
|
-
pv: [
|
|
13644
|
+
pv: [
|
|
13645
|
+
"version",
|
|
13646
|
+
"name",
|
|
13647
|
+
"description",
|
|
13648
|
+
"nodeTypes",
|
|
13649
|
+
"edgeTypes",
|
|
13650
|
+
"pathConfig",
|
|
13651
|
+
"display",
|
|
13652
|
+
"scope",
|
|
13653
|
+
"audit"
|
|
13654
|
+
],
|
|
13642
13655
|
pvPathConfig: [
|
|
13643
13656
|
"projectRoot",
|
|
13644
13657
|
"captureSource",
|
|
@@ -13990,33 +14003,14 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
13990
14003
|
nodeType
|
|
13991
14004
|
);
|
|
13992
14005
|
if (!isStandardType) {
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
13997
|
-
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
});
|
|
14002
|
-
} else {
|
|
14003
|
-
const nodePv = n.pv;
|
|
14004
|
-
if (typeof nodePv.nodeType !== "string" || !nodePv.nodeType) {
|
|
14005
|
-
issues.push({
|
|
14006
|
-
type: "error",
|
|
14007
|
-
message: `Node "${n.id || index}" with custom type must have "pv.nodeType"`,
|
|
14008
|
-
path: `nodes[${index}].pv.nodeType`
|
|
14009
|
-
});
|
|
14010
|
-
}
|
|
14011
|
-
if (typeof nodePv.shape !== "string" || !VALID_NODE_SHAPES.includes(nodePv.shape)) {
|
|
14012
|
-
issues.push({
|
|
14013
|
-
type: "error",
|
|
14014
|
-
message: `Node "${n.id || index}" must have a valid "pv.shape"`,
|
|
14015
|
-
path: `nodes[${index}].pv.shape`,
|
|
14016
|
-
suggestion: `Valid shapes: ${VALID_NODE_SHAPES.join(", ")}`
|
|
14017
|
-
});
|
|
14018
|
-
}
|
|
14019
|
-
}
|
|
14006
|
+
issues.push({
|
|
14007
|
+
type: "error",
|
|
14008
|
+
message: `Node "${n.id || index}" uses invalid type "${nodeType}"`,
|
|
14009
|
+
path: `nodes[${index}].type`,
|
|
14010
|
+
suggestion: `Use a standard JSON Canvas type (${STANDARD_CANVAS_TYPES.join(
|
|
14011
|
+
", "
|
|
14012
|
+
)}). For custom shapes, use type: "text" with pv.shape: "${nodeType}"`
|
|
14013
|
+
});
|
|
14020
14014
|
}
|
|
14021
14015
|
if (n.pv && typeof n.pv === "object") {
|
|
14022
14016
|
const nodePv = n.pv;
|
|
@@ -14164,7 +14158,9 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
14164
14158
|
type: "error",
|
|
14165
14159
|
message: `Edge "${edgeLabel}" must have a "fromSide" field`,
|
|
14166
14160
|
path: `${edgePath}.fromSide`,
|
|
14167
|
-
suggestion: `Specify which side of the source node the edge starts from: ${VALID_SIDES.join(
|
|
14161
|
+
suggestion: `Specify which side of the source node the edge starts from: ${VALID_SIDES.join(
|
|
14162
|
+
", "
|
|
14163
|
+
)}`
|
|
14168
14164
|
});
|
|
14169
14165
|
} else if (!VALID_SIDES.includes(e.fromSide)) {
|
|
14170
14166
|
issues.push({
|
|
@@ -14179,7 +14175,9 @@ function validateCanvas(canvas, filePath, library) {
|
|
|
14179
14175
|
type: "error",
|
|
14180
14176
|
message: `Edge "${edgeLabel}" must have a "toSide" field`,
|
|
14181
14177
|
path: `${edgePath}.toSide`,
|
|
14182
|
-
suggestion: `Specify which side of the target node the edge connects to: ${VALID_SIDES.join(
|
|
14178
|
+
suggestion: `Specify which side of the target node the edge connects to: ${VALID_SIDES.join(
|
|
14179
|
+
", "
|
|
14180
|
+
)}`
|
|
14183
14181
|
});
|
|
14184
14182
|
} else if (!VALID_SIDES.includes(e.toSide)) {
|
|
14185
14183
|
issues.push({
|
|
@@ -14306,7 +14304,7 @@ function createValidateCommand() {
|
|
|
14306
14304
|
} else {
|
|
14307
14305
|
console.log(source_default.yellow("No .canvas files found matching the specified patterns."));
|
|
14308
14306
|
console.log(source_default.dim(`Patterns searched: ${patterns.join(", ")}`));
|
|
14309
|
-
console.log(source_default.dim("\nTo create a new .principal-views folder, run:
|
|
14307
|
+
console.log(source_default.dim("\nTo create a new .principal-views folder, run: npx @principal-ai/principal-view-cli init"));
|
|
14310
14308
|
}
|
|
14311
14309
|
return;
|
|
14312
14310
|
}
|
|
@@ -14530,7 +14528,7 @@ edgeComponents: {}
|
|
|
14530
14528
|
if (isHuskyInstalled(gitRoot)) {
|
|
14531
14529
|
if ((0, import_node_fs5.existsSync)(preCommitFile)) {
|
|
14532
14530
|
const existingContent = (0, import_node_fs5.readFileSync)(preCommitFile, "utf8");
|
|
14533
|
-
if (existingContent.includes("principal-view-cli lint")
|
|
14531
|
+
if (existingContent.includes("principal-view-cli lint")) {
|
|
14534
14532
|
console.log(
|
|
14535
14533
|
source_default.yellow(`Husky pre-commit hook already includes principal view linting`)
|
|
14536
14534
|
);
|
|
@@ -14607,16 +14605,16 @@ edgeComponents: {}
|
|
|
14607
14605
|
console.log(
|
|
14608
14606
|
` 2. Build your graph in ${source_default.cyan(`.principal-views/${options.name}.canvas`)}`
|
|
14609
14607
|
);
|
|
14610
|
-
console.log(` 3. Run ${source_default.cyan("
|
|
14608
|
+
console.log(` 3. Run ${source_default.cyan("npx @principal-ai/principal-view-cli lint")} to validate your configuration`);
|
|
14611
14609
|
if (huskySetup) {
|
|
14612
14610
|
console.log(` 4. Commits will now automatically lint .principal-views files`);
|
|
14613
14611
|
}
|
|
14614
14612
|
console.log("");
|
|
14615
14613
|
console.log(source_default.bold("Commands:"));
|
|
14616
|
-
console.log(` \u2022 ${source_default.cyan("
|
|
14617
|
-
console.log(` \u2022 ${source_default.cyan("
|
|
14618
|
-
console.log(` \u2022 ${source_default.cyan("
|
|
14619
|
-
console.log(` \u2022 ${source_default.cyan("
|
|
14614
|
+
console.log(` \u2022 ${source_default.cyan("npx @principal-ai/principal-view-cli lint")} - Lint configuration files`);
|
|
14615
|
+
console.log(` \u2022 ${source_default.cyan("npx @principal-ai/principal-view-cli lint --json")} - Output lint results as JSON`);
|
|
14616
|
+
console.log(` \u2022 ${source_default.cyan("npx @principal-ai/principal-view-cli validate")} - Validate canvas files`);
|
|
14617
|
+
console.log(` \u2022 ${source_default.cyan("npx @principal-ai/principal-view-cli doctor")} - Check project setup`);
|
|
14620
14618
|
} catch (error) {
|
|
14621
14619
|
console.error(source_default.red("Error:"), error.message);
|
|
14622
14620
|
process.exit(1);
|
|
@@ -14662,7 +14660,7 @@ function createListCommand() {
|
|
|
14662
14660
|
if (!options.all) {
|
|
14663
14661
|
console.log(source_default.dim("Run with --all to search all directories"));
|
|
14664
14662
|
}
|
|
14665
|
-
console.log(source_default.dim("\nTo create a new canvas, run:
|
|
14663
|
+
console.log(source_default.dim("\nTo create a new canvas, run: npx @principal-ai/principal-view-cli init"));
|
|
14666
14664
|
}
|
|
14667
14665
|
return;
|
|
14668
14666
|
}
|
|
@@ -14721,7 +14719,7 @@ ${source_default.dim("\u2502")} }
|
|
|
14721
14719
|
${source_default.dim("\u2502")} } ${source_default.dim("\u2502")}
|
|
14722
14720
|
${source_default.dim("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")}
|
|
14723
14721
|
|
|
14724
|
-
Run ${source_default.cyan("
|
|
14722
|
+
Run ${source_default.cyan("npx @principal-ai/principal-view-cli schema <section>")} for details on:
|
|
14725
14723
|
${source_default.yellow("nodes")} Node types and properties
|
|
14726
14724
|
${source_default.yellow("edges")} Edge properties and types
|
|
14727
14725
|
${source_default.yellow("vv")} Principal View extension fields
|
|
@@ -15012,8 +15010,8 @@ ${source_default.dim("\u2500".repeat(50))}
|
|
|
15012
15010
|
}
|
|
15013
15011
|
}
|
|
15014
15012
|
|
|
15015
|
-
${source_default.bold("Run validation:")} ${source_default.cyan("
|
|
15016
|
-
${source_default.bold("Initialize project:")} ${source_default.cyan("
|
|
15013
|
+
${source_default.bold("Run validation:")} ${source_default.cyan("npx @principal-ai/principal-view-cli validate <file>")}
|
|
15014
|
+
${source_default.bold("Initialize project:")} ${source_default.cyan("npx @principal-ai/principal-view-cli init")}
|
|
15017
15015
|
`
|
|
15018
15016
|
};
|
|
15019
15017
|
function createSchemaCommand() {
|
|
@@ -15154,7 +15152,7 @@ function createDoctorCommand() {
|
|
|
15154
15152
|
);
|
|
15155
15153
|
} else {
|
|
15156
15154
|
console.log(source_default.yellow("No .principal-views directory found."));
|
|
15157
|
-
console.log(source_default.dim('Run "
|
|
15155
|
+
console.log(source_default.dim('Run "npx @principal-ai/principal-view-cli init" to create a configuration.'));
|
|
15158
15156
|
}
|
|
15159
15157
|
return;
|
|
15160
15158
|
}
|
|
@@ -15292,17 +15290,17 @@ var VV_HOOK_MARKER = "# Principal View checks";
|
|
|
15292
15290
|
function getVVHookContent() {
|
|
15293
15291
|
return `${VV_HOOK_MARKER}
|
|
15294
15292
|
echo "Running Principal View doctor check..."
|
|
15295
|
-
npx
|
|
15293
|
+
npx @principal-ai/principal-view-cli doctor --errors-only || {
|
|
15296
15294
|
echo "\u274C Principal View doctor check failed (errors found)"
|
|
15297
|
-
echo " Run '
|
|
15295
|
+
echo " Run 'npx @principal-ai/principal-view-cli doctor' to see details"
|
|
15298
15296
|
exit 1
|
|
15299
15297
|
}
|
|
15300
15298
|
|
|
15301
15299
|
echo "Running Principal View canvas validation..."
|
|
15302
|
-
npx
|
|
15300
|
+
npx @principal-ai/principal-view-cli validate --quiet 2>/dev/null || {
|
|
15303
15301
|
if [ $? -ne 0 ]; then
|
|
15304
15302
|
echo "\u274C Canvas validation failed"
|
|
15305
|
-
echo " Run '
|
|
15303
|
+
echo " Run 'npx @principal-ai/principal-view-cli validate' to see details"
|
|
15306
15304
|
exit 1
|
|
15307
15305
|
fi
|
|
15308
15306
|
}
|
|
@@ -15403,7 +15401,7 @@ function removeVVHook(repoPath) {
|
|
|
15403
15401
|
let i = startIndex + 1;
|
|
15404
15402
|
while (i < lines.length && inVVBlock) {
|
|
15405
15403
|
const line = lines[i];
|
|
15406
|
-
if (line && (line.includes("
|
|
15404
|
+
if (line && (line.includes("@principal-ai/principal-view-cli ") || line.includes("Principal View") || line.includes('echo "Running Visual') || line.includes("exit 1") && i > startIndex && i < startIndex + 15 || line === "}" && i > startIndex && i < startIndex + 15 || line.trim() === "" && i === startIndex + 1)) {
|
|
15407
15405
|
endIndex = i;
|
|
15408
15406
|
i++;
|
|
15409
15407
|
} else if (line && line.trim() === "" && i < startIndex + 15) {
|
|
@@ -15438,11 +15436,11 @@ function createHooksCommand() {
|
|
|
15438
15436
|
if (!isHuskyInstalled2(repoPath)) {
|
|
15439
15437
|
if (options.check) {
|
|
15440
15438
|
console.log(source_default.red("\u274C Husky is not installed"));
|
|
15441
|
-
console.log(' Run "
|
|
15439
|
+
console.log(' Run "npx @principal-ai/principal-view-cli hooks --init" to install husky');
|
|
15442
15440
|
process.exit(1);
|
|
15443
15441
|
} else if (options.add) {
|
|
15444
15442
|
console.log(source_default.red("\u274C Husky is not installed"));
|
|
15445
|
-
console.log(' Run "
|
|
15443
|
+
console.log(' Run "npx @principal-ai/principal-view-cli hooks --init" first to install husky');
|
|
15446
15444
|
process.exit(1);
|
|
15447
15445
|
} else if (options.remove) {
|
|
15448
15446
|
console.log("\u2139\uFE0F Husky is not installed");
|
|
@@ -15450,7 +15448,7 @@ function createHooksCommand() {
|
|
|
15450
15448
|
} else {
|
|
15451
15449
|
console.log(source_default.red("\u274C Husky is not installed in this repository"));
|
|
15452
15450
|
console.log("\nTo install husky and set up Principal View hooks:");
|
|
15453
|
-
console.log("
|
|
15451
|
+
console.log(" npx @principal-ai/principal-view-cli hooks --init --add");
|
|
15454
15452
|
process.exit(1);
|
|
15455
15453
|
}
|
|
15456
15454
|
}
|
|
@@ -15469,7 +15467,7 @@ function createHooksCommand() {
|
|
|
15469
15467
|
addVVHook(repoPath);
|
|
15470
15468
|
console.log(source_default.green("\u2705 Added Principal View checks to pre-commit hook"));
|
|
15471
15469
|
console.log("\nPre-commit hook will now:");
|
|
15472
|
-
console.log(" \u2022 Run
|
|
15470
|
+
console.log(" \u2022 Run npx @principal-ai/principal-view-cli doctor to check for stale configurations");
|
|
15473
15471
|
console.log(" \u2022 Validate all .canvas files");
|
|
15474
15472
|
}
|
|
15475
15473
|
} else if (options.remove) {
|
|
@@ -15535,8 +15533,8 @@ function createCreateCommand() {
|
|
|
15535
15533
|
` 1. Open ${source_default.cyan(`.principal-views/${options.name}.canvas`)} in your editor`
|
|
15536
15534
|
);
|
|
15537
15535
|
console.log(` 2. Add nodes and edges to define your architecture`);
|
|
15538
|
-
console.log(` 3. Run ${source_default.cyan("
|
|
15539
|
-
console.log(` 4. Run ${source_default.cyan("
|
|
15536
|
+
console.log(` 3. Run ${source_default.cyan("npx @principal-ai/principal-view-cli validate")} to check your configuration`);
|
|
15537
|
+
console.log(` 4. Run ${source_default.cyan("npx @principal-ai/principal-view-cli doctor")} to verify source mappings`);
|
|
15540
15538
|
} catch (error) {
|
|
15541
15539
|
console.error(source_default.red("Error:"), error.message);
|
|
15542
15540
|
process.exit(1);
|