@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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Fixer Module Exports
3
+ */
4
+
5
+ export * from './framework-fixes.js';
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 { htmlPath } = context;
452
- const frameworkLower = framework.name.toLowerCase();
453
-
454
- // For React/Vite apps, recommend react-helmet-async
455
- if (frameworkLower.includes('react') || frameworkLower.includes('vite') || framework.name === 'Unknown') {
456
- return {
457
- issue: { code: 'SPA_NO_META_MANAGEMENT', message: 'SPA without dynamic meta tag management', severity: 'warning' },
458
- file: 'src/components/SEOHead.tsx',
459
- before: null,
460
- after: `import { Helmet } from 'react-helmet-async';
461
-
462
- interface SEOHeadProps {
463
- title?: string;
464
- description?: string;
465
- image?: string;
466
- url?: string;
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: htmlPath,
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: '<!-- Add a meta management library for your framework -->',
505
- explanation: `Add dynamic meta tag management for ${framework.name}`,
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';