@tpitre/story-ui 1.7.0 โ 1.7.1
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/cli/index.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
import { validateStoryCode, extractAndValidateCodeBlock } from '../story-generator/validateStory.js';
|
|
3
|
+
console.log('๐งช Testing Story UI validation improvements...\n');
|
|
4
|
+
// Test 1: Truncated JSX code
|
|
5
|
+
const truncatedJSX = `import React from 'react';
|
|
6
|
+
import { Card, Button, Input } from 'antd';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Test/Truncated',
|
|
10
|
+
component: Card,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const Default = {
|
|
14
|
+
args: {
|
|
15
|
+
children: (
|
|
16
|
+
<div>
|
|
17
|
+
<Card>
|
|
18
|
+
<h1>Hello World</h1>
|
|
19
|
+
<Input placeholder="Enter text" />
|
|
20
|
+
<Button type="primary">Submit</Button>
|
|
21
|
+
<div>
|
|
22
|
+
<span>Nested content that gets`;
|
|
23
|
+
console.log('Test 1: Truncated JSX code');
|
|
24
|
+
const result1 = validateStoryCode(truncatedJSX);
|
|
25
|
+
console.log('Valid:', result1.isValid);
|
|
26
|
+
console.log('Errors:', result1.errors.length);
|
|
27
|
+
if (result1.fixedCode) {
|
|
28
|
+
console.log('โ
Code was automatically fixed!');
|
|
29
|
+
console.log('Fixed code ends with:', result1.fixedCode.slice(-100));
|
|
30
|
+
}
|
|
31
|
+
console.log('\n---\n');
|
|
32
|
+
// Test 2: Missing closing braces
|
|
33
|
+
const missingBraces = `import React from 'react';
|
|
34
|
+
import { Card } from 'antd';
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
title: 'Test/MissingBraces',
|
|
38
|
+
component: Card,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Default = {
|
|
42
|
+
args: {
|
|
43
|
+
children: (
|
|
44
|
+
<Card>
|
|
45
|
+
<h1>Test</h1>
|
|
46
|
+
</Card>
|
|
47
|
+
)
|
|
48
|
+
}`;
|
|
49
|
+
console.log('Test 2: Missing closing braces');
|
|
50
|
+
const result2 = validateStoryCode(missingBraces);
|
|
51
|
+
console.log('Valid:', result2.isValid);
|
|
52
|
+
console.log('Errors:', result2.errors.length);
|
|
53
|
+
if (result2.fixedCode) {
|
|
54
|
+
console.log('โ
Code was automatically fixed!');
|
|
55
|
+
}
|
|
56
|
+
console.log('\n---\n');
|
|
57
|
+
// Test 3: AI response with code block
|
|
58
|
+
const aiResponse = `\`\`\`typescript
|
|
59
|
+
import React from 'react';
|
|
60
|
+
import { Card, Table } from 'antd';
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
title: 'Test/Dashboard',
|
|
64
|
+
component: Card,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Default = {
|
|
68
|
+
args: {
|
|
69
|
+
children: (
|
|
70
|
+
<div>
|
|
71
|
+
<Card title="Dashboard">
|
|
72
|
+
<Table dataSource={[]} columns={[]} />
|
|
73
|
+
\`\`\``;
|
|
74
|
+
console.log('Test 3: AI response extraction and validation');
|
|
75
|
+
const result3 = extractAndValidateCodeBlock(aiResponse);
|
|
76
|
+
console.log('Valid:', result3.isValid);
|
|
77
|
+
console.log('Errors:', result3.errors.length);
|
|
78
|
+
if (result3.fixedCode) {
|
|
79
|
+
console.log('โ
Code was automatically fixed!');
|
|
80
|
+
}
|
|
81
|
+
console.log('\nโจ Validation testing complete!');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../index.ts","../story-ui.config.loader.ts","../story-ui.config.ts","../cli/index.ts","../cli/setup.ts","../mcp-server/index.ts","../mcp-server/routes/claude.ts","../mcp-server/routes/components.ts","../mcp-server/routes/generatestory.ts","../mcp-server/routes/memorystories.ts","../mcp-server/routes/storysync.ts","../story-generator/componentdiscovery.ts","../story-generator/configloader.ts","../story-generator/generatestory.ts","../story-generator/gitignoremanager.ts","../story-generator/inmemorystoryservice.ts","../story-generator/productiongitignoremanager.ts","../story-generator/promptgenerator.ts","../story-generator/storysync.ts"],"version":"5.8.3"}
|