@rankcli/agent-runtime 0.0.6 → 0.0.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.d.mts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +701 -51
- package/dist/index.mjs +685 -51
- package/package.json +1 -1
- package/src/fixer/framework-fixes.ts +743 -0
- package/src/fixer/index.ts +5 -0
- package/src/fixer.ts +21 -54
- package/src/index.ts +1 -0
package/src/fixer.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import type { SEOIssue, Fix, FrameworkInfo } from './types.js';
|
|
4
4
|
import { detectFramework, findHtmlEntry, readFile } from './tools/files.js';
|
|
5
5
|
import { generateH1Fix } from './tools/h1-fixer.js';
|
|
6
|
+
import { getFrameworkSpecificFix } from './fixer/framework-fixes.js';
|
|
6
7
|
|
|
7
8
|
export interface FixGeneratorOptions {
|
|
8
9
|
cwd: string;
|
|
@@ -448,63 +449,29 @@ function generateSitemapFix(context: FixContext, url: string): GeneratedFix {
|
|
|
448
449
|
}
|
|
449
450
|
|
|
450
451
|
function generateSPAMetaFix(context: FixContext, framework: FrameworkInfo): GeneratedFix {
|
|
451
|
-
const {
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
export function SEOHead({
|
|
470
|
-
title = 'Your Site Name',
|
|
471
|
-
description = 'Your site description',
|
|
472
|
-
image = '/og-image.png',
|
|
473
|
-
url = window.location.href,
|
|
474
|
-
}: SEOHeadProps) {
|
|
475
|
-
return (
|
|
476
|
-
<Helmet>
|
|
477
|
-
<title>{title}</title>
|
|
478
|
-
<meta name="description" content={description} />
|
|
479
|
-
<link rel="canonical" href={url} />
|
|
480
|
-
|
|
481
|
-
{/* Open Graph */}
|
|
482
|
-
<meta property="og:title" content={title} />
|
|
483
|
-
<meta property="og:description" content={description} />
|
|
484
|
-
<meta property="og:image" content={image} />
|
|
485
|
-
<meta property="og:url" content={url} />
|
|
486
|
-
<meta property="og:type" content="website" />
|
|
487
|
-
|
|
488
|
-
{/* Twitter */}
|
|
489
|
-
<meta name="twitter:card" content="summary_large_image" />
|
|
490
|
-
<meta name="twitter:title" content={title} />
|
|
491
|
-
<meta name="twitter:description" content={description} />
|
|
492
|
-
<meta name="twitter:image" content={image} />
|
|
493
|
-
</Helmet>
|
|
494
|
-
);
|
|
495
|
-
}`,
|
|
496
|
-
explanation: 'Created SEOHead component using react-helmet-async for dynamic meta tags. Install: npm install react-helmet-async',
|
|
497
|
-
};
|
|
498
|
-
}
|
|
452
|
+
const { url } = context;
|
|
453
|
+
const fullUrl = url || 'https://example.com';
|
|
454
|
+
const siteName = new URL(fullUrl).hostname.replace('www.', '').split('.')[0];
|
|
455
|
+
const capitalizedName = siteName.charAt(0).toUpperCase() + siteName.slice(1);
|
|
456
|
+
|
|
457
|
+
const generatedCode = getFrameworkSpecificFix(framework, {
|
|
458
|
+
siteName: capitalizedName,
|
|
459
|
+
siteUrl: fullUrl,
|
|
460
|
+
title: `${capitalizedName} - Your tagline here`,
|
|
461
|
+
description: `${capitalizedName} - A compelling description of your product or service.`,
|
|
462
|
+
image: `${fullUrl}/og-image.png`,
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
const installInstructions = generatedCode.installCommands
|
|
466
|
+
? `\n\nInstall: ${generatedCode.installCommands.join(' && ')}`
|
|
467
|
+
: '';
|
|
499
468
|
|
|
500
469
|
return {
|
|
501
|
-
issue: { code: 'SPA_NO_META_MANAGEMENT', message: 'SPA without meta management', severity: 'warning' },
|
|
502
|
-
file:
|
|
470
|
+
issue: { code: 'SPA_NO_META_MANAGEMENT', message: 'SPA without dynamic meta tag management', severity: 'warning' },
|
|
471
|
+
file: generatedCode.file,
|
|
503
472
|
before: null,
|
|
504
|
-
after:
|
|
505
|
-
explanation:
|
|
506
|
-
skipped: true,
|
|
507
|
-
skipReason: `Framework-specific solution needed for ${framework.name}`,
|
|
473
|
+
after: generatedCode.code,
|
|
474
|
+
explanation: generatedCode.explanation + installInstructions,
|
|
508
475
|
};
|
|
509
476
|
}
|
|
510
477
|
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export type { ExecuteOptions, ExecutionResult } from './executor.js';
|
|
|
25
25
|
// Fix generator
|
|
26
26
|
export { generateFixes, applyFixes } from './fixer.js';
|
|
27
27
|
export type { FixGeneratorOptions, GeneratedFix } from './fixer.js';
|
|
28
|
+
export * from './fixer/framework-fixes.js';
|
|
28
29
|
|
|
29
30
|
// Tools
|
|
30
31
|
export { tools } from './tools/index.js';
|