skrypt-ai 0.3.3 → 0.4.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.
Files changed (97) hide show
  1. package/README.md +1 -1
  2. package/dist/auth/index.d.ts +0 -1
  3. package/dist/auth/index.js +3 -5
  4. package/dist/autofix/index.js +15 -3
  5. package/dist/cli.js +19 -4
  6. package/dist/commands/check-links.js +164 -174
  7. package/dist/commands/deploy.js +5 -2
  8. package/dist/commands/generate.js +206 -199
  9. package/dist/commands/i18n.js +3 -20
  10. package/dist/commands/init.js +47 -40
  11. package/dist/commands/lint.js +3 -20
  12. package/dist/commands/mcp.js +125 -122
  13. package/dist/commands/monitor.js +125 -108
  14. package/dist/commands/review-pr.js +1 -1
  15. package/dist/commands/sdk.js +1 -1
  16. package/dist/config/loader.js +21 -2
  17. package/dist/generator/organizer.d.ts +3 -0
  18. package/dist/generator/organizer.js +4 -9
  19. package/dist/generator/writer.js +2 -10
  20. package/dist/github/pr-comments.js +21 -8
  21. package/dist/plugins/index.js +1 -0
  22. package/dist/scanner/index.js +8 -2
  23. package/dist/template/docs.json +2 -1
  24. package/dist/template/next.config.mjs +3 -1
  25. package/dist/template/package.json +17 -14
  26. package/dist/template/public/favicon.svg +4 -0
  27. package/dist/template/public/search-index.json +1 -1
  28. package/dist/template/scripts/build-search-index.mjs +120 -25
  29. package/dist/template/src/app/api/chat/route.ts +11 -3
  30. package/dist/template/src/app/docs/README.md +28 -0
  31. package/dist/template/src/app/docs/[...slug]/page.tsx +141 -14
  32. package/dist/template/src/app/docs/auth/page.mdx +589 -0
  33. package/dist/template/src/app/docs/autofix/page.mdx +624 -0
  34. package/dist/template/src/app/docs/cli/page.mdx +217 -0
  35. package/dist/template/src/app/docs/config/page.mdx +428 -0
  36. package/dist/template/src/app/docs/configuration/page.mdx +86 -0
  37. package/dist/template/src/app/docs/deployment/page.mdx +112 -0
  38. package/dist/template/src/app/docs/error.tsx +20 -0
  39. package/dist/template/src/app/docs/generator/generator.md +504 -0
  40. package/dist/template/src/app/docs/generator/organizer.md +779 -0
  41. package/dist/template/src/app/docs/generator/page.mdx +613 -0
  42. package/dist/template/src/app/docs/github/page.mdx +502 -0
  43. package/dist/template/src/app/docs/llm/anthropic-client.md +549 -0
  44. package/dist/template/src/app/docs/llm/index.md +471 -0
  45. package/dist/template/src/app/docs/llm/page.mdx +428 -0
  46. package/dist/template/src/app/docs/llms-full.md +256 -0
  47. package/dist/template/src/app/docs/llms.txt +2971 -0
  48. package/dist/template/src/app/docs/not-found.tsx +23 -0
  49. package/dist/template/src/app/docs/page.mdx +0 -3
  50. package/dist/template/src/app/docs/plugins/page.mdx +1793 -0
  51. package/dist/template/src/app/docs/pro/page.mdx +121 -0
  52. package/dist/template/src/app/docs/quickstart/page.mdx +93 -0
  53. package/dist/template/src/app/docs/scanner/content-type.md +599 -0
  54. package/dist/template/src/app/docs/scanner/index.md +212 -0
  55. package/dist/template/src/app/docs/scanner/page.mdx +307 -0
  56. package/dist/template/src/app/docs/scanner/python.md +469 -0
  57. package/dist/template/src/app/docs/scanner/python_parser.md +1056 -0
  58. package/dist/template/src/app/docs/scanner/rust.md +325 -0
  59. package/dist/template/src/app/docs/scanner/typescript.md +201 -0
  60. package/dist/template/src/app/error.tsx +3 -3
  61. package/dist/template/src/app/icon.tsx +29 -0
  62. package/dist/template/src/app/layout.tsx +57 -7
  63. package/dist/template/src/app/not-found.tsx +35 -0
  64. package/dist/template/src/app/page.tsx +95 -11
  65. package/dist/template/src/components/ai-chat.tsx +26 -21
  66. package/dist/template/src/components/breadcrumbs.tsx +56 -12
  67. package/dist/template/src/components/copy-button.tsx +17 -3
  68. package/dist/template/src/components/docs-layout.tsx +202 -8
  69. package/dist/template/src/components/feedback.tsx +4 -2
  70. package/dist/template/src/components/footer.tsx +42 -0
  71. package/dist/template/src/components/header.tsx +56 -20
  72. package/dist/template/src/components/mdx/accordion.tsx +17 -13
  73. package/dist/template/src/components/mdx/callout.tsx +50 -37
  74. package/dist/template/src/components/mdx/card.tsx +24 -12
  75. package/dist/template/src/components/mdx/code-block.tsx +17 -3
  76. package/dist/template/src/components/mdx/code-group.tsx +78 -18
  77. package/dist/template/src/components/mdx/code-playground.tsx +3 -0
  78. package/dist/template/src/components/mdx/go-playground.tsx +3 -0
  79. package/dist/template/src/components/mdx/highlighted-code.tsx +178 -38
  80. package/dist/template/src/components/mdx/python-playground.tsx +2 -0
  81. package/dist/template/src/components/mdx/steps.tsx +6 -6
  82. package/dist/template/src/components/mdx/tabs.tsx +76 -8
  83. package/dist/template/src/components/page-header.tsx +19 -0
  84. package/dist/template/src/components/scroll-to-top.tsx +33 -0
  85. package/dist/template/src/components/search-dialog.tsx +251 -57
  86. package/dist/template/src/components/sidebar.tsx +137 -77
  87. package/dist/template/src/components/table-of-contents.tsx +29 -13
  88. package/dist/template/src/lib/highlight.ts +90 -31
  89. package/dist/template/src/lib/search.ts +14 -4
  90. package/dist/template/src/lib/theme-utils.ts +140 -0
  91. package/dist/template/src/styles/globals.css +397 -84
  92. package/dist/template/src/types/remark-gfm.d.ts +2 -0
  93. package/dist/utils/files.d.ts +9 -0
  94. package/dist/utils/files.js +33 -0
  95. package/dist/utils/validation.d.ts +4 -0
  96. package/dist/utils/validation.js +38 -0
  97. package/package.json +1 -4
@@ -2,6 +2,7 @@ import { mkdir, writeFile } from 'fs/promises';
2
2
  import { dirname, join, basename, relative } from 'path';
3
3
  import { formatAsMarkdown } from './generator.js';
4
4
  import { organizeByTopic, detectCrossReferences, getCrossRefsForElement } from './organizer.js';
5
+ import { slugify } from '../utils/files.js';
5
6
  /**
6
7
  * Generate llms.txt file (Answer Engine Optimization)
7
8
  * Format follows https://llmstxt.org convention
@@ -90,7 +91,7 @@ export async function writeDocsToDirectory(results, outputDir, sourceDir) {
90
91
  // Create subdirectories if needed
91
92
  await mkdir(dirname(outputPath), { recursive: true });
92
93
  // Generate markdown content
93
- const title = basename(result.filePath, '.py')
94
+ const title = basename(result.filePath).replace(/\.[^.]+$/, '')
94
95
  .replace(/^./, c => c.toUpperCase())
95
96
  .replace(/_/g, ' ');
96
97
  const content = formatAsMarkdown(result.docs, title);
@@ -313,12 +314,3 @@ async function writeSidebarConfig(topics, outputDir) {
313
314
  };
314
315
  await writeFile(join(outputDir, '_sidebars.json'), JSON.stringify(docusaurusSidebar, null, 2), 'utf-8');
315
316
  }
316
- /**
317
- * Convert string to URL-safe slug
318
- */
319
- function slugify(str) {
320
- return str
321
- .toLowerCase()
322
- .replace(/[^a-z0-9]+/g, '-')
323
- .replace(/^-|-$/g, '');
324
- }
@@ -4,6 +4,7 @@
4
4
  * Posts documentation suggestions and issues as PR comments.
5
5
  * Requires: GITHUB_TOKEN environment variable
6
6
  */
7
+ import ts from 'typescript';
7
8
  const GITHUB_API = 'https://api.github.com';
8
9
  /**
9
10
  * Post a review comment on a PR
@@ -31,6 +32,7 @@ export async function postPRComment(config, issues) {
31
32
  'User-Agent': 'skrypt-cli',
32
33
  },
33
34
  body: JSON.stringify({ body }),
35
+ signal: AbortSignal.timeout(30000),
34
36
  });
35
37
  if (!response.ok) {
36
38
  const error = await response.text();
@@ -42,7 +44,7 @@ export async function postPRComment(config, issues) {
42
44
  const data = await response.json();
43
45
  return {
44
46
  success: true,
45
- commentId: data.id,
47
+ commentId: data?.id,
46
48
  };
47
49
  }
48
50
  catch (err) {
@@ -71,6 +73,7 @@ export async function postInlineComments(config, issues) {
71
73
  Accept: 'application/vnd.github.v3+json',
72
74
  'User-Agent': 'skrypt-cli',
73
75
  },
76
+ signal: AbortSignal.timeout(30000),
74
77
  });
75
78
  if (!prResponse.ok) {
76
79
  return [{
@@ -79,7 +82,7 @@ export async function postInlineComments(config, issues) {
79
82
  }];
80
83
  }
81
84
  const pr = await prResponse.json();
82
- const commitId = pr.head.sha;
85
+ const commitId = pr?.head?.sha;
83
86
  const results = [];
84
87
  for (const issue of issues) {
85
88
  if (!issue.line)
@@ -100,10 +103,11 @@ export async function postInlineComments(config, issues) {
100
103
  line: issue.line,
101
104
  side: 'RIGHT',
102
105
  }),
106
+ signal: AbortSignal.timeout(30000),
103
107
  });
104
108
  if (response.ok) {
105
109
  const data = await response.json();
106
- results.push({ success: true, commentId: data.id });
110
+ results.push({ success: true, commentId: data?.id });
107
111
  }
108
112
  else {
109
113
  const error = await response.text();
@@ -205,6 +209,7 @@ export async function analyzePRForDocs(config, _options = {}) {
205
209
  Accept: 'application/vnd.github.v3+json',
206
210
  'User-Agent': 'skrypt-cli',
207
211
  },
212
+ signal: AbortSignal.timeout(30000),
208
213
  });
209
214
  if (!response.ok) {
210
215
  throw new Error('Could not fetch PR files');
@@ -286,11 +291,19 @@ function checkCodeBlocks(patch, filename) {
286
291
  }
287
292
  // Check for obviously broken syntax
288
293
  if (language === 'javascript' || language === 'typescript') {
289
- try {
290
- new Function(code);
291
- }
292
- catch (err) {
293
- const errMsg = err instanceof Error ? err.message : String(err);
294
+ const result = ts.transpileModule(code, {
295
+ compilerOptions: {
296
+ module: ts.ModuleKind.ESNext,
297
+ target: ts.ScriptTarget.ES2020,
298
+ },
299
+ reportDiagnostics: true,
300
+ });
301
+ if (result.diagnostics && result.diagnostics.length > 0) {
302
+ const errMsg = result.diagnostics[0]
303
+ ? (typeof result.diagnostics[0].messageText === 'string'
304
+ ? result.diagnostics[0].messageText
305
+ : result.diagnostics[0].messageText.messageText)
306
+ : 'Unknown error';
294
307
  // Only flag if it's clearly meant to be runnable
295
308
  if (!code.includes('// ...') && code.length > 20) {
296
309
  issues.push({
@@ -1,3 +1,4 @@
1
+ // TODO: Plugin system is defined but not yet wired into the generate pipeline
1
2
  import { existsSync } from 'fs';
2
3
  import { resolve } from 'path';
3
4
  import { pathToFileURL } from 'url';
@@ -1,5 +1,5 @@
1
1
  import { readdir, stat } from 'fs/promises';
2
- import { join, extname } from 'path';
2
+ import { join, extname, parse as parsePath } from 'path';
3
3
  import { PythonScanner } from './python.js';
4
4
  import { TypeScriptScanner } from './typescript.js';
5
5
  import { GoScanner } from './go.js';
@@ -135,9 +135,15 @@ export async function scanDirectory(dir, options = {}) {
135
135
  export async function scanFile(filePath) {
136
136
  const scanner = getScannerForFile(filePath);
137
137
  if (!scanner) {
138
+ const ext = parsePath(filePath).ext.slice(1);
139
+ const langMap = {
140
+ ts: 'typescript', tsx: 'typescript', js: 'javascript', jsx: 'javascript',
141
+ py: 'python', go: 'go', rs: 'rust',
142
+ };
143
+ const language = langMap[ext] ?? 'typescript';
138
144
  return {
139
145
  filePath,
140
- language: 'python', // default
146
+ language,
141
147
  elements: [],
142
148
  errors: [`No scanner available for ${filePath}`]
143
149
  };
@@ -3,7 +3,8 @@
3
3
  "description": "Documentation generated with Skrypt",
4
4
  "theme": {
5
5
  "primaryColor": "#3b82f6",
6
- "accentColor": "#8b5cf6"
6
+ "accentColor": "#8b5cf6",
7
+ "font": "Inter"
7
8
  },
8
9
  "navigation": [
9
10
  {
@@ -1,9 +1,11 @@
1
1
  import createMDX from '@next/mdx'
2
+ import remarkGfm from 'remark-gfm'
3
+ import remarkFrontmatter from 'remark-frontmatter'
2
4
 
3
5
  const withMDX = createMDX({
4
6
  extension: /\.mdx?$/,
5
7
  options: {
6
- remarkPlugins: [],
8
+ remarkPlugins: [remarkGfm, remarkFrontmatter],
7
9
  rehypePlugins: [],
8
10
  },
9
11
  })
@@ -10,30 +10,33 @@
10
10
  "start": "next start"
11
11
  },
12
12
  "dependencies": {
13
- "next": "^15.3.0",
14
- "react": "^19.0.0",
15
- "react-dom": "^19.0.0",
16
- "@next/mdx": "^15.3.0",
13
+ "@codesandbox/sandpack-react": "^2.20.0",
17
14
  "@mdx-js/loader": "^3.1.0",
18
15
  "@mdx-js/react": "^3.1.0",
19
- "next-mdx-remote": "^5.0.0",
20
- "shiki": "^3.0.0",
16
+ "@next/mdx": "^15.3.0",
21
17
  "@orama/orama": "^3.1.0",
22
- "lucide-react": "^0.500.0",
18
+ "@scalar/nextjs-api-reference": "^0.4.0",
23
19
  "clsx": "^2.1.0",
24
- "tailwind-merge": "^3.0.0",
25
20
  "gray-matter": "^4.0.3",
26
- "@scalar/nextjs-api-reference": "^0.4.0",
27
- "@codesandbox/sandpack-react": "^2.20.0"
21
+ "lucide-react": "^0.500.0",
22
+ "next": "^15.3.0",
23
+ "next-mdx-remote": "^6.0.0",
24
+ "react": "^19.0.0",
25
+ "react-dom": "^19.0.0",
26
+ "remark-frontmatter": "^5.0.0",
27
+ "remark-gfm": "^4.0.0",
28
+ "shiki": "^3.0.0",
29
+ "tailwind-merge": "^3.0.0",
30
+ "yaml": "^2.8.2"
28
31
  },
29
32
  "devDependencies": {
33
+ "@tailwindcss/postcss": "^4.1.0",
34
+ "@types/mdx": "^2.0.0",
30
35
  "@types/node": "^22.0.0",
31
36
  "@types/react": "^19.0.0",
32
37
  "@types/react-dom": "^19.0.0",
33
- "@types/mdx": "^2.0.0",
34
- "typescript": "^5.8.0",
38
+ "postcss": "^8.5.0",
35
39
  "tailwindcss": "^4.1.0",
36
- "@tailwindcss/postcss": "^4.1.0",
37
- "postcss": "^8.5.0"
40
+ "typescript": "^5.8.0"
38
41
  }
39
42
  }
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32">
2
+ <rect width="32" height="32" rx="6" fill="#3b82f6"/>
3
+ <text x="16" y="23" font-family="system-ui, -apple-system, sans-serif" font-size="20" font-weight="700" fill="white" text-anchor="middle">S</text>
4
+ </svg>