popeye-cli 1.4.7 → 1.6.0
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/CHANGELOG.md +54 -0
- package/README.md +264 -63
- package/dist/adapters/gemini.d.ts +1 -0
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +9 -4
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/grok.d.ts +1 -0
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +9 -4
- package/dist/adapters/grok.js.map +1 -1
- package/dist/adapters/openai.d.ts +1 -1
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +35 -9
- package/dist/adapters/openai.js.map +1 -1
- package/dist/cli/commands/create.d.ts.map +1 -1
- package/dist/cli/commands/create.js +54 -4
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/interactive.d.ts +29 -0
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +132 -7
- package/dist/cli/interactive.js.map +1 -1
- package/dist/generators/all.d.ts +8 -2
- package/dist/generators/all.d.ts.map +1 -1
- package/dist/generators/all.js +37 -316
- package/dist/generators/all.js.map +1 -1
- package/dist/generators/doc-parser.d.ts +64 -0
- package/dist/generators/doc-parser.d.ts.map +1 -0
- package/dist/generators/doc-parser.js +407 -0
- package/dist/generators/doc-parser.js.map +1 -0
- package/dist/generators/frontend-design-analyzer.d.ts +30 -0
- package/dist/generators/frontend-design-analyzer.d.ts.map +1 -0
- package/dist/generators/frontend-design-analyzer.js +208 -0
- package/dist/generators/frontend-design-analyzer.js.map +1 -0
- package/dist/generators/shared-packages.d.ts +45 -0
- package/dist/generators/shared-packages.d.ts.map +1 -0
- package/dist/generators/shared-packages.js +456 -0
- package/dist/generators/shared-packages.js.map +1 -0
- package/dist/generators/templates/index.d.ts +8 -0
- package/dist/generators/templates/index.d.ts.map +1 -1
- package/dist/generators/templates/index.js +8 -0
- package/dist/generators/templates/index.js.map +1 -1
- package/dist/generators/templates/website-components.d.ts +33 -0
- package/dist/generators/templates/website-components.d.ts.map +1 -0
- package/dist/generators/templates/website-components.js +303 -0
- package/dist/generators/templates/website-components.js.map +1 -0
- package/dist/generators/templates/website-config.d.ts +55 -0
- package/dist/generators/templates/website-config.d.ts.map +1 -0
- package/dist/generators/templates/website-config.js +425 -0
- package/dist/generators/templates/website-config.js.map +1 -0
- package/dist/generators/templates/website-conversion.d.ts +27 -0
- package/dist/generators/templates/website-conversion.d.ts.map +1 -0
- package/dist/generators/templates/website-conversion.js +326 -0
- package/dist/generators/templates/website-conversion.js.map +1 -0
- package/dist/generators/templates/website-landing.d.ts +24 -0
- package/dist/generators/templates/website-landing.d.ts.map +1 -0
- package/dist/generators/templates/website-landing.js +276 -0
- package/dist/generators/templates/website-landing.js.map +1 -0
- package/dist/generators/templates/website-layout.d.ts +42 -0
- package/dist/generators/templates/website-layout.d.ts.map +1 -0
- package/dist/generators/templates/website-layout.js +408 -0
- package/dist/generators/templates/website-layout.js.map +1 -0
- package/dist/generators/templates/website-pricing.d.ts +11 -0
- package/dist/generators/templates/website-pricing.d.ts.map +1 -0
- package/dist/generators/templates/website-pricing.js +313 -0
- package/dist/generators/templates/website-pricing.js.map +1 -0
- package/dist/generators/templates/website-sections.d.ts +102 -0
- package/dist/generators/templates/website-sections.d.ts.map +1 -0
- package/dist/generators/templates/website-sections.js +444 -0
- package/dist/generators/templates/website-sections.js.map +1 -0
- package/dist/generators/templates/website-seo.d.ts +76 -0
- package/dist/generators/templates/website-seo.d.ts.map +1 -0
- package/dist/generators/templates/website-seo.js +326 -0
- package/dist/generators/templates/website-seo.js.map +1 -0
- package/dist/generators/templates/website.d.ts +10 -83
- package/dist/generators/templates/website.d.ts.map +1 -1
- package/dist/generators/templates/website.js +12 -875
- package/dist/generators/templates/website.js.map +1 -1
- package/dist/generators/website-content-scanner.d.ts +37 -0
- package/dist/generators/website-content-scanner.d.ts.map +1 -0
- package/dist/generators/website-content-scanner.js +165 -0
- package/dist/generators/website-content-scanner.js.map +1 -0
- package/dist/generators/website-context.d.ts +119 -0
- package/dist/generators/website-context.d.ts.map +1 -0
- package/dist/generators/website-context.js +350 -0
- package/dist/generators/website-context.js.map +1 -0
- package/dist/generators/website-debug.d.ts +68 -0
- package/dist/generators/website-debug.d.ts.map +1 -0
- package/dist/generators/website-debug.js +93 -0
- package/dist/generators/website-debug.js.map +1 -0
- package/dist/generators/website.d.ts +5 -0
- package/dist/generators/website.d.ts.map +1 -1
- package/dist/generators/website.js +136 -11
- package/dist/generators/website.js.map +1 -1
- package/dist/generators/workspace-root.d.ts +27 -0
- package/dist/generators/workspace-root.d.ts.map +1 -0
- package/dist/generators/workspace-root.js +100 -0
- package/dist/generators/workspace-root.js.map +1 -0
- package/dist/state/index.d.ts +35 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +40 -0
- package/dist/state/index.js.map +1 -1
- package/dist/types/consensus.d.ts +3 -0
- package/dist/types/consensus.d.ts.map +1 -1
- package/dist/types/consensus.js +1 -0
- package/dist/types/consensus.js.map +1 -1
- package/dist/types/website-strategy.d.ts +263 -0
- package/dist/types/website-strategy.d.ts.map +1 -0
- package/dist/types/website-strategy.js +105 -0
- package/dist/types/website-strategy.js.map +1 -0
- package/dist/types/workflow.d.ts +21 -0
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/types/workflow.js +8 -0
- package/dist/types/workflow.js.map +1 -1
- package/dist/upgrade/handlers.d.ts +15 -0
- package/dist/upgrade/handlers.d.ts.map +1 -1
- package/dist/upgrade/handlers.js +52 -0
- package/dist/upgrade/handlers.js.map +1 -1
- package/dist/workflow/auto-fix-bundler.d.ts +37 -0
- package/dist/workflow/auto-fix-bundler.d.ts.map +1 -0
- package/dist/workflow/auto-fix-bundler.js +320 -0
- package/dist/workflow/auto-fix-bundler.js.map +1 -0
- package/dist/workflow/auto-fix.d.ts.map +1 -1
- package/dist/workflow/auto-fix.js +10 -3
- package/dist/workflow/auto-fix.js.map +1 -1
- package/dist/workflow/consensus.d.ts.map +1 -1
- package/dist/workflow/consensus.js +2 -0
- package/dist/workflow/consensus.js.map +1 -1
- package/dist/workflow/execution-mode.d.ts.map +1 -1
- package/dist/workflow/execution-mode.js +18 -0
- package/dist/workflow/execution-mode.js.map +1 -1
- package/dist/workflow/index.d.ts +4 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +37 -0
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/overview.d.ts +89 -0
- package/dist/workflow/overview.d.ts.map +1 -0
- package/dist/workflow/overview.js +358 -0
- package/dist/workflow/overview.js.map +1 -0
- package/dist/workflow/plan-mode.d.ts +6 -4
- package/dist/workflow/plan-mode.d.ts.map +1 -1
- package/dist/workflow/plan-mode.js +148 -6
- package/dist/workflow/plan-mode.js.map +1 -1
- package/dist/workflow/website-strategy.d.ts +79 -0
- package/dist/workflow/website-strategy.d.ts.map +1 -0
- package/dist/workflow/website-strategy.js +310 -0
- package/dist/workflow/website-strategy.js.map +1 -0
- package/dist/workflow/website-updater.d.ts +17 -0
- package/dist/workflow/website-updater.d.ts.map +1 -0
- package/dist/workflow/website-updater.js +116 -0
- package/dist/workflow/website-updater.js.map +1 -0
- package/dist/workflow/workflow-logger.d.ts +1 -1
- package/dist/workflow/workflow-logger.d.ts.map +1 -1
- package/dist/workflow/workflow-logger.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/gemini.ts +10 -4
- package/src/adapters/grok.ts +10 -4
- package/src/adapters/openai.ts +38 -6
- package/src/cli/commands/create.ts +58 -4
- package/src/cli/interactive.ts +143 -7
- package/src/generators/all.ts +49 -332
- package/src/generators/doc-parser.ts +449 -0
- package/src/generators/frontend-design-analyzer.ts +261 -0
- package/src/generators/shared-packages.ts +500 -0
- package/src/generators/templates/index.ts +8 -0
- package/src/generators/templates/website-components.ts +330 -0
- package/src/generators/templates/website-config.ts +444 -0
- package/src/generators/templates/website-conversion.ts +341 -0
- package/src/generators/templates/website-landing.ts +331 -0
- package/src/generators/templates/website-layout.ts +443 -0
- package/src/generators/templates/website-pricing.ts +330 -0
- package/src/generators/templates/website-sections.ts +541 -0
- package/src/generators/templates/website-seo.ts +370 -0
- package/src/generators/templates/website.ts +38 -905
- package/src/generators/website-content-scanner.ts +208 -0
- package/src/generators/website-context.ts +493 -0
- package/src/generators/website-debug.ts +130 -0
- package/src/generators/website.ts +178 -20
- package/src/generators/workspace-root.ts +113 -0
- package/src/state/index.ts +56 -0
- package/src/types/consensus.ts +3 -0
- package/src/types/website-strategy.ts +243 -0
- package/src/types/workflow.ts +21 -0
- package/src/upgrade/handlers.ts +65 -0
- package/src/workflow/auto-fix-bundler.ts +392 -0
- package/src/workflow/auto-fix.ts +11 -3
- package/src/workflow/consensus.ts +2 -0
- package/src/workflow/execution-mode.ts +21 -0
- package/src/workflow/index.ts +37 -0
- package/src/workflow/overview.ts +475 -0
- package/src/workflow/plan-mode.ts +193 -8
- package/src/workflow/website-strategy.ts +379 -0
- package/src/workflow/website-updater.ts +142 -0
- package/src/workflow/workflow-logger.ts +1 -0
- package/tests/adapters/persona-switching.test.ts +63 -0
- package/tests/cli/project-naming.test.ts +136 -0
- package/tests/generators/doc-parser.test.ts +121 -0
- package/tests/generators/frontend-design-analyzer.test.ts +90 -0
- package/tests/generators/quality-gate.test.ts +183 -0
- package/tests/generators/shared-packages.test.ts +83 -0
- package/tests/generators/website-components.test.ts +159 -0
- package/tests/generators/website-config.test.ts +84 -0
- package/tests/generators/website-content-scanner.test.ts +181 -0
- package/tests/generators/website-context.test.ts +331 -0
- package/tests/generators/website-debug.test.ts +77 -0
- package/tests/generators/website-landing.test.ts +188 -0
- package/tests/generators/website-pricing.test.ts +98 -0
- package/tests/generators/website-sections.test.ts +245 -0
- package/tests/generators/website-seo-quality.test.ts +246 -0
- package/tests/generators/workspace-root.test.ts +105 -0
- package/tests/upgrade/handlers.test.ts +162 -0
- package/tests/workflow/auto-fix-bundler.test.ts +242 -0
- package/tests/workflow/overview.test.ts +392 -0
- package/tests/workflow/plan-mode.test.ts +111 -1
- package/tests/workflow/website-strategy.test.ts +246 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website.js","sourceRoot":"","sources":["../../../src/generators/templates/website.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"website.js","sourceRoot":"","sources":["../../../src/generators/templates/website.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qCAAqC;AACrC,OAAO,EAAE,0BAA0B,EAAE,kCAAkC,EAAE,MAAM,sBAAsB,CAAC;AAGtG,0CAA0C;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,6BAA6B;AAC7B,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,8BAA8B;AAC9B,OAAO,EACL,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,8BAA8B,EAC9B,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-generation content scanner
|
|
3
|
+
* Scans generated website files for known placeholder fingerprints
|
|
4
|
+
* and reports quality issues as warnings
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A single scan issue found in a generated file
|
|
8
|
+
*/
|
|
9
|
+
export interface ScanIssue {
|
|
10
|
+
/** Relative file path within the website directory */
|
|
11
|
+
file: string;
|
|
12
|
+
/** Human-readable description of the issue */
|
|
13
|
+
message: string;
|
|
14
|
+
/** Severity: error = likely broken, warning = looks generic */
|
|
15
|
+
severity: 'error' | 'warning';
|
|
16
|
+
/** Line number where the issue was found (approximate) */
|
|
17
|
+
line?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Result of scanning generated website content
|
|
21
|
+
*/
|
|
22
|
+
export interface ScanResult {
|
|
23
|
+
/** All issues found across scanned files */
|
|
24
|
+
issues: ScanIssue[];
|
|
25
|
+
/** Number of files scanned */
|
|
26
|
+
filesScanned: number;
|
|
27
|
+
/** Content quality score 0-100 based on issues found */
|
|
28
|
+
score: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Scan generated website files for placeholder fingerprints
|
|
32
|
+
*
|
|
33
|
+
* @param websiteDir - The website project directory to scan
|
|
34
|
+
* @returns Scan result with issues and quality score
|
|
35
|
+
*/
|
|
36
|
+
export declare function scanGeneratedContent(websiteDir: string): Promise<ScanResult>;
|
|
37
|
+
//# sourceMappingURL=website-content-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"website-content-scanner.d.ts","sourceRoot":"","sources":["../../src/generators/website-content-scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;CACf;AA4HD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA4ClF"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-generation content scanner
|
|
3
|
+
* Scans generated website files for known placeholder fingerprints
|
|
4
|
+
* and reports quality issues as warnings
|
|
5
|
+
*/
|
|
6
|
+
import { promises as fs } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
/**
|
|
9
|
+
* Known placeholder patterns to detect in generated files
|
|
10
|
+
*/
|
|
11
|
+
const PLACEHOLDER_PATTERNS = [
|
|
12
|
+
{
|
|
13
|
+
pattern: /\/\*\s*TODO[^*]*\*\//,
|
|
14
|
+
message: 'Contains TODO block comment',
|
|
15
|
+
severity: 'error',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
pattern: /\{\/\*\s*TODO[^*]*\*\/\}/,
|
|
19
|
+
message: 'Contains JSX TODO comment',
|
|
20
|
+
severity: 'error',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
pattern: /\/\/\s*TODO\b/,
|
|
24
|
+
message: 'Contains TODO line comment',
|
|
25
|
+
severity: 'error',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
pattern: /Build something amazing/,
|
|
29
|
+
message: 'Default tagline "Build something amazing"',
|
|
30
|
+
severity: 'warning',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
pattern: /Your modern web application/,
|
|
34
|
+
message: 'Generic description "Your modern web application"',
|
|
35
|
+
severity: 'warning',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
pattern: /Lorem ipsum/i,
|
|
39
|
+
message: 'Contains lorem ipsum placeholder text',
|
|
40
|
+
severity: 'error',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
pattern: /\$29(?:\/mo)?/,
|
|
44
|
+
message: 'Default pricing amount ($29/mo)',
|
|
45
|
+
severity: 'warning',
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Multi-line patterns checked against the full file content
|
|
50
|
+
* These detect combinations that indicate default/template content
|
|
51
|
+
*/
|
|
52
|
+
const COMPOSITE_PATTERNS = [
|
|
53
|
+
{
|
|
54
|
+
pattern: /name:\s*['"]Starter['"][\s\S]{0,500}name:\s*['"]Pro['"][\s\S]{0,500}name:\s*['"]Enterprise['"]/,
|
|
55
|
+
message: 'Default pricing tiers (Starter/Pro/Enterprise)',
|
|
56
|
+
severity: 'warning',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
pattern: /title:\s*['"]Sign Up['"][\s\S]{0,500}title:\s*['"]Configure['"][\s\S]{0,500}title:\s*['"]Deploy['"]/,
|
|
60
|
+
message: 'Default "How It Works" steps (Sign Up/Configure/Deploy)',
|
|
61
|
+
severity: 'warning',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* File extensions to scan within the website directory
|
|
66
|
+
*/
|
|
67
|
+
const SCANNABLE_EXTENSIONS = new Set(['.tsx', '.ts', '.jsx', '.js', '.css']);
|
|
68
|
+
/**
|
|
69
|
+
* Directories to skip during scanning
|
|
70
|
+
*/
|
|
71
|
+
const SKIP_DIRS = new Set(['node_modules', '.next', 'dist', 'build', 'coverage']);
|
|
72
|
+
/**
|
|
73
|
+
* Recursively collect scannable files from a directory
|
|
74
|
+
*
|
|
75
|
+
* @param dir - Directory to scan
|
|
76
|
+
* @param baseDir - Base directory for relative path calculation
|
|
77
|
+
* @returns Array of absolute file paths
|
|
78
|
+
*/
|
|
79
|
+
async function collectFiles(dir, baseDir) {
|
|
80
|
+
const results = [];
|
|
81
|
+
try {
|
|
82
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
83
|
+
for (const entry of entries) {
|
|
84
|
+
if (entry.isDirectory()) {
|
|
85
|
+
if (SKIP_DIRS.has(entry.name))
|
|
86
|
+
continue;
|
|
87
|
+
const subFiles = await collectFiles(path.join(dir, entry.name), baseDir);
|
|
88
|
+
results.push(...subFiles);
|
|
89
|
+
}
|
|
90
|
+
else if (entry.isFile()) {
|
|
91
|
+
const ext = path.extname(entry.name);
|
|
92
|
+
if (SCANNABLE_EXTENSIONS.has(ext)) {
|
|
93
|
+
results.push(path.join(dir, entry.name));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Directory not accessible, skip
|
|
100
|
+
}
|
|
101
|
+
return results;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Find the approximate line number for a regex match in content
|
|
105
|
+
*
|
|
106
|
+
* @param content - File content
|
|
107
|
+
* @param pattern - Pattern to search for
|
|
108
|
+
* @returns Line number (1-based) or undefined
|
|
109
|
+
*/
|
|
110
|
+
function findLineNumber(content, pattern) {
|
|
111
|
+
const match = content.match(pattern);
|
|
112
|
+
if (!match || match.index === undefined)
|
|
113
|
+
return undefined;
|
|
114
|
+
const beforeMatch = content.slice(0, match.index);
|
|
115
|
+
return beforeMatch.split('\n').length;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Scan generated website files for placeholder fingerprints
|
|
119
|
+
*
|
|
120
|
+
* @param websiteDir - The website project directory to scan
|
|
121
|
+
* @returns Scan result with issues and quality score
|
|
122
|
+
*/
|
|
123
|
+
export async function scanGeneratedContent(websiteDir) {
|
|
124
|
+
const issues = [];
|
|
125
|
+
const files = await collectFiles(path.join(websiteDir, 'src'), websiteDir);
|
|
126
|
+
let score = 100;
|
|
127
|
+
for (const filePath of files) {
|
|
128
|
+
try {
|
|
129
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
130
|
+
const relativePath = path.relative(websiteDir, filePath);
|
|
131
|
+
// Check per-line patterns
|
|
132
|
+
for (const { pattern, message, severity } of PLACEHOLDER_PATTERNS) {
|
|
133
|
+
if (pattern.test(content)) {
|
|
134
|
+
issues.push({
|
|
135
|
+
file: relativePath,
|
|
136
|
+
message,
|
|
137
|
+
severity,
|
|
138
|
+
line: findLineNumber(content, pattern),
|
|
139
|
+
});
|
|
140
|
+
score -= severity === 'error' ? 15 : 5;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Check composite (multi-line) patterns
|
|
144
|
+
for (const { pattern, message, severity } of COMPOSITE_PATTERNS) {
|
|
145
|
+
if (pattern.test(content)) {
|
|
146
|
+
issues.push({
|
|
147
|
+
file: relativePath,
|
|
148
|
+
message,
|
|
149
|
+
severity,
|
|
150
|
+
});
|
|
151
|
+
score -= severity === 'error' ? 15 : 5;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// Skip unreadable files
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
issues,
|
|
161
|
+
filesScanned: files.length,
|
|
162
|
+
score: Math.max(0, Math.min(100, score)),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=website-content-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"website-content-scanner.js","sourceRoot":"","sources":["../../src/generators/website-content-scanner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AA4B7B;;GAEG;AACH,MAAM,oBAAoB,GAIrB;IACH;QACE,OAAO,EAAE,sBAAsB;QAC/B,OAAO,EAAE,6BAA6B;QACtC,QAAQ,EAAE,OAAO;KAClB;IACD;QACE,OAAO,EAAE,0BAA0B;QACnC,OAAO,EAAE,2BAA2B;QACpC,QAAQ,EAAE,OAAO;KAClB;IACD;QACE,OAAO,EAAE,eAAe;QACxB,OAAO,EAAE,4BAA4B;QACrC,QAAQ,EAAE,OAAO;KAClB;IACD;QACE,OAAO,EAAE,yBAAyB;QAClC,OAAO,EAAE,2CAA2C;QACpD,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,OAAO,EAAE,6BAA6B;QACtC,OAAO,EAAE,mDAAmD;QAC5D,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,OAA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
|
|
3
|
+
* Discovers user documentation and brand assets to populate website templates
|
|
4
|
+
* with project-specific content instead of generic placeholders
|
|
5
|
+
*/
|
|
6
|
+
import type { WebsiteStrategyDocument, BrandAssetsContract } from '../types/website-strategy.js';
|
|
7
|
+
/**
|
|
8
|
+
* Structured content context for website generation
|
|
9
|
+
*/
|
|
10
|
+
export interface WebsiteContentContext {
|
|
11
|
+
productName: string;
|
|
12
|
+
tagline?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
features: Array<{
|
|
15
|
+
title: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}>;
|
|
18
|
+
pricing?: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
price: string;
|
|
21
|
+
period?: string;
|
|
22
|
+
description: string;
|
|
23
|
+
features: string[];
|
|
24
|
+
cta: string;
|
|
25
|
+
featured?: boolean;
|
|
26
|
+
}>;
|
|
27
|
+
brand?: {
|
|
28
|
+
primaryColor?: string;
|
|
29
|
+
colorScheme?: Record<string, string>;
|
|
30
|
+
logoPath?: string;
|
|
31
|
+
};
|
|
32
|
+
rawDocs: string;
|
|
33
|
+
/** Website marketing strategy (generated by AI from product context) */
|
|
34
|
+
strategy?: WebsiteStrategyDocument;
|
|
35
|
+
/** Resolved brand assets contract for deterministic logo/favicon placement */
|
|
36
|
+
brandAssets?: BrandAssetsContract;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve brand assets into a deterministic contract
|
|
40
|
+
* Searches for logo/favicon in project directory and workspace root,
|
|
41
|
+
* sets canonical output paths
|
|
42
|
+
*
|
|
43
|
+
* @param cwd - Directory to scan for brand assets
|
|
44
|
+
* @param brandContext - Optional existing brand context from state
|
|
45
|
+
* @returns Resolved brand assets contract
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveBrandAssets(cwd: string, brandContext?: {
|
|
48
|
+
logoPath?: string;
|
|
49
|
+
primaryColor?: string;
|
|
50
|
+
}): Promise<BrandAssetsContract>;
|
|
51
|
+
/**
|
|
52
|
+
* Discover project documentation files in a directory
|
|
53
|
+
*
|
|
54
|
+
* @param cwd - Directory to scan for documentation
|
|
55
|
+
* @returns Array of absolute paths to discovered doc files
|
|
56
|
+
*/
|
|
57
|
+
export declare function discoverProjectDocs(cwd: string): Promise<string[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Find brand assets (logo files) in a directory
|
|
60
|
+
* Also searches workspace root and parent directories
|
|
61
|
+
*
|
|
62
|
+
* @param cwd - Directory to scan for brand assets
|
|
63
|
+
* @returns Object with optional logoPath
|
|
64
|
+
*/
|
|
65
|
+
export declare function findBrandAssets(cwd: string): Promise<{
|
|
66
|
+
logoPath?: string;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* Read and concatenate project documentation files
|
|
70
|
+
*
|
|
71
|
+
* @param docPaths - Array of absolute paths to doc files
|
|
72
|
+
* @param maxLength - Maximum combined length (default 25000 chars)
|
|
73
|
+
* @returns Combined documentation content with file headers
|
|
74
|
+
*/
|
|
75
|
+
export declare function readProjectDocs(docPaths: string[], maxLength?: number): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Build a structured website content context from discovered docs
|
|
78
|
+
*
|
|
79
|
+
* @param cwd - Working directory to scan for docs
|
|
80
|
+
* @param projectName - The project name (folder name fallback)
|
|
81
|
+
* @param specification - Optional expanded specification text
|
|
82
|
+
* @returns Structured content context for website templates
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildWebsiteContext(cwd: string, projectName: string, specification?: string): Promise<WebsiteContentContext>;
|
|
85
|
+
/**
|
|
86
|
+
* Result of soft (non-throwing) website context validation
|
|
87
|
+
*/
|
|
88
|
+
export interface ValidationResult {
|
|
89
|
+
/** Whether the context is sufficient for generation (no blocking issues) */
|
|
90
|
+
passed: boolean;
|
|
91
|
+
/** Blocking problems that prevent quality generation */
|
|
92
|
+
issues: string[];
|
|
93
|
+
/** Non-blocking concerns about content quality */
|
|
94
|
+
warnings: string[];
|
|
95
|
+
/** Content quality score 0-100, deducted for each default/missing piece */
|
|
96
|
+
contentScore: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Validate website content context without throwing
|
|
100
|
+
* Returns structured result with issues, warnings, and a content quality score
|
|
101
|
+
*
|
|
102
|
+
* @param context - The built website content context
|
|
103
|
+
* @param projectName - The project name for validation
|
|
104
|
+
* @returns Validation result with issues, warnings, and score
|
|
105
|
+
*/
|
|
106
|
+
export declare function validateWebsiteContext(context: WebsiteContentContext, _projectName: string): ValidationResult;
|
|
107
|
+
/**
|
|
108
|
+
* Validate website content context and throw if insufficient
|
|
109
|
+
* Prevents generation of generic websites with placeholder content
|
|
110
|
+
*
|
|
111
|
+
* @param context - The built website content context
|
|
112
|
+
* @param projectName - The project name for validation
|
|
113
|
+
* @throws Error with actionable message if context is insufficient
|
|
114
|
+
*/
|
|
115
|
+
export declare function validateWebsiteContextOrThrow(context: WebsiteContentContext, projectName: string): {
|
|
116
|
+
passed: boolean;
|
|
117
|
+
issues: string[];
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=website-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"website-context.d.ts","sourceRoot":"","sources":["../../src/generators/website-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKjG;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM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