skrypt-ai 0.4.2 → 0.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.
Files changed (159) hide show
  1. package/dist/auth/index.d.ts +13 -3
  2. package/dist/auth/index.js +101 -9
  3. package/dist/auth/keychain.d.ts +5 -0
  4. package/dist/auth/keychain.js +82 -0
  5. package/dist/auth/notices.d.ts +3 -0
  6. package/dist/auth/notices.js +42 -0
  7. package/dist/autofix/index.d.ts +0 -4
  8. package/dist/autofix/index.js +10 -24
  9. package/dist/capture/browser.d.ts +11 -0
  10. package/dist/capture/browser.js +173 -0
  11. package/dist/capture/diff.d.ts +23 -0
  12. package/dist/capture/diff.js +52 -0
  13. package/dist/capture/index.d.ts +23 -0
  14. package/dist/capture/index.js +210 -0
  15. package/dist/capture/naming.d.ts +17 -0
  16. package/dist/capture/naming.js +45 -0
  17. package/dist/capture/parser.d.ts +15 -0
  18. package/dist/capture/parser.js +80 -0
  19. package/dist/capture/types.d.ts +57 -0
  20. package/dist/capture/types.js +1 -0
  21. package/dist/cli.js +20 -3
  22. package/dist/commands/autofix.js +136 -120
  23. package/dist/commands/cron.js +58 -47
  24. package/dist/commands/deploy.js +123 -102
  25. package/dist/commands/generate.js +125 -7
  26. package/dist/commands/heal.d.ts +10 -0
  27. package/dist/commands/heal.js +201 -0
  28. package/dist/commands/i18n.js +146 -111
  29. package/dist/commands/import.d.ts +2 -0
  30. package/dist/commands/import.js +157 -0
  31. package/dist/commands/init.js +19 -7
  32. package/dist/commands/lint.js +50 -44
  33. package/dist/commands/llms-txt.js +59 -49
  34. package/dist/commands/login.js +63 -34
  35. package/dist/commands/mcp.js +6 -0
  36. package/dist/commands/monitor.js +13 -8
  37. package/dist/commands/qa.d.ts +2 -0
  38. package/dist/commands/qa.js +43 -0
  39. package/dist/commands/review-pr.js +108 -92
  40. package/dist/commands/sdk.js +128 -122
  41. package/dist/commands/security.d.ts +2 -0
  42. package/dist/commands/security.js +109 -0
  43. package/dist/commands/test.js +91 -92
  44. package/dist/commands/version.js +104 -75
  45. package/dist/commands/watch.js +130 -114
  46. package/dist/config/types.js +2 -2
  47. package/dist/context-hub/index.d.ts +23 -0
  48. package/dist/context-hub/index.js +179 -0
  49. package/dist/context-hub/mappings.d.ts +8 -0
  50. package/dist/context-hub/mappings.js +55 -0
  51. package/dist/context-hub/types.d.ts +33 -0
  52. package/dist/context-hub/types.js +1 -0
  53. package/dist/generator/generator.js +39 -6
  54. package/dist/generator/types.d.ts +7 -0
  55. package/dist/generator/writer.d.ts +3 -1
  56. package/dist/generator/writer.js +36 -7
  57. package/dist/importers/confluence.d.ts +5 -0
  58. package/dist/importers/confluence.js +137 -0
  59. package/dist/importers/detect.d.ts +20 -0
  60. package/dist/importers/detect.js +121 -0
  61. package/dist/importers/docusaurus.d.ts +5 -0
  62. package/dist/importers/docusaurus.js +279 -0
  63. package/dist/importers/gitbook.d.ts +5 -0
  64. package/dist/importers/gitbook.js +189 -0
  65. package/dist/importers/github.d.ts +8 -0
  66. package/dist/importers/github.js +99 -0
  67. package/dist/importers/index.d.ts +15 -0
  68. package/dist/importers/index.js +30 -0
  69. package/dist/importers/markdown.d.ts +6 -0
  70. package/dist/importers/markdown.js +105 -0
  71. package/dist/importers/mintlify.d.ts +5 -0
  72. package/dist/importers/mintlify.js +172 -0
  73. package/dist/importers/notion.d.ts +5 -0
  74. package/dist/importers/notion.js +174 -0
  75. package/dist/importers/readme.d.ts +5 -0
  76. package/dist/importers/readme.js +184 -0
  77. package/dist/importers/transform.d.ts +90 -0
  78. package/dist/importers/transform.js +457 -0
  79. package/dist/importers/types.d.ts +37 -0
  80. package/dist/importers/types.js +1 -0
  81. package/dist/llm/anthropic-client.d.ts +1 -0
  82. package/dist/llm/anthropic-client.js +3 -1
  83. package/dist/llm/index.d.ts +6 -4
  84. package/dist/llm/index.js +76 -261
  85. package/dist/llm/openai-client.d.ts +1 -0
  86. package/dist/llm/openai-client.js +7 -2
  87. package/dist/plugins/index.js +7 -0
  88. package/dist/qa/checks.d.ts +10 -0
  89. package/dist/qa/checks.js +492 -0
  90. package/dist/qa/fixes.d.ts +30 -0
  91. package/dist/qa/fixes.js +277 -0
  92. package/dist/qa/index.d.ts +29 -0
  93. package/dist/qa/index.js +187 -0
  94. package/dist/qa/types.d.ts +24 -0
  95. package/dist/qa/types.js +1 -0
  96. package/dist/scanner/csharp.d.ts +23 -0
  97. package/dist/scanner/csharp.js +421 -0
  98. package/dist/scanner/index.js +53 -26
  99. package/dist/scanner/java.d.ts +39 -0
  100. package/dist/scanner/java.js +318 -0
  101. package/dist/scanner/kotlin.d.ts +23 -0
  102. package/dist/scanner/kotlin.js +389 -0
  103. package/dist/scanner/php.d.ts +57 -0
  104. package/dist/scanner/php.js +351 -0
  105. package/dist/scanner/python.js +17 -0
  106. package/dist/scanner/ruby.d.ts +36 -0
  107. package/dist/scanner/ruby.js +431 -0
  108. package/dist/scanner/swift.d.ts +25 -0
  109. package/dist/scanner/swift.js +392 -0
  110. package/dist/scanner/types.d.ts +1 -1
  111. package/dist/template/content/docs/_navigation.json +46 -0
  112. package/dist/template/content/docs/_sidebars.json +684 -0
  113. package/dist/template/content/docs/core.md +4544 -0
  114. package/dist/template/content/docs/index.mdx +89 -0
  115. package/dist/template/content/docs/integrations.md +1158 -0
  116. package/dist/template/content/docs/llms-full.md +403 -0
  117. package/dist/template/content/docs/llms.txt +4588 -0
  118. package/dist/template/content/docs/other.md +10379 -0
  119. package/dist/template/content/docs/tools.md +746 -0
  120. package/dist/template/content/docs/types.md +531 -0
  121. package/dist/template/docs.json +13 -11
  122. package/dist/template/mdx-components.tsx +27 -2
  123. package/dist/template/package.json +6 -0
  124. package/dist/template/public/search-index.json +1 -1
  125. package/dist/template/scripts/build-search-index.mjs +149 -13
  126. package/dist/template/src/app/api/chat/route.ts +83 -128
  127. package/dist/template/src/app/docs/[...slug]/page.tsx +75 -20
  128. package/dist/template/src/app/docs/llms-full.md +151 -4
  129. package/dist/template/src/app/docs/llms.txt +2464 -847
  130. package/dist/template/src/app/docs/page.mdx +48 -38
  131. package/dist/template/src/app/layout.tsx +3 -1
  132. package/dist/template/src/app/page.tsx +22 -8
  133. package/dist/template/src/components/ai-chat.tsx +73 -64
  134. package/dist/template/src/components/breadcrumbs.tsx +21 -23
  135. package/dist/template/src/components/copy-button.tsx +13 -9
  136. package/dist/template/src/components/copy-page-button.tsx +54 -0
  137. package/dist/template/src/components/docs-layout.tsx +37 -25
  138. package/dist/template/src/components/header.tsx +51 -10
  139. package/dist/template/src/components/mdx/card.tsx +17 -3
  140. package/dist/template/src/components/mdx/code-block.tsx +13 -9
  141. package/dist/template/src/components/mdx/code-group.tsx +13 -8
  142. package/dist/template/src/components/mdx/heading.tsx +15 -2
  143. package/dist/template/src/components/mdx/highlighted-code.tsx +13 -8
  144. package/dist/template/src/components/mdx/index.tsx +2 -0
  145. package/dist/template/src/components/mdx/mermaid.tsx +110 -0
  146. package/dist/template/src/components/mdx/screenshot.tsx +150 -0
  147. package/dist/template/src/components/scroll-to-hash.tsx +48 -0
  148. package/dist/template/src/components/sidebar.tsx +12 -18
  149. package/dist/template/src/components/table-of-contents.tsx +9 -0
  150. package/dist/template/src/lib/highlight.ts +3 -88
  151. package/dist/template/src/lib/navigation.ts +159 -0
  152. package/dist/template/src/lib/search-types.ts +4 -1
  153. package/dist/template/src/lib/search.ts +30 -7
  154. package/dist/template/src/styles/globals.css +17 -6
  155. package/dist/utils/files.d.ts +9 -1
  156. package/dist/utils/files.js +59 -10
  157. package/dist/utils/validation.d.ts +0 -3
  158. package/dist/utils/validation.js +0 -26
  159. package/package.json +5 -1
@@ -1,25 +1,41 @@
1
- import { readdirSync, statSync } from 'fs';
1
+ import { readdirSync, statSync, lstatSync } from 'fs';
2
2
  import { join, extname } from 'path';
3
3
  /**
4
4
  * Recursively find all .md and .mdx files in a directory.
5
- * Skips hidden directories and node_modules.
5
+ * Skips hidden directories, node_modules, and symlinks.
6
6
  */
7
7
  export function findMdxFiles(dir) {
8
8
  const files = [];
9
- function walk(currentDir) {
10
- const entries = readdirSync(currentDir);
9
+ function walk(currentDir, depth) {
10
+ if (depth > 30)
11
+ return;
12
+ let entries;
13
+ try {
14
+ entries = readdirSync(currentDir);
15
+ }
16
+ catch {
17
+ return;
18
+ }
11
19
  for (const entry of entries) {
12
20
  const fullPath = join(currentDir, entry);
13
- const stat = statSync(fullPath);
14
- if (stat.isDirectory() && !entry.startsWith('.') && entry !== 'node_modules') {
15
- walk(fullPath);
21
+ try {
22
+ // Skip symlinks to prevent infinite loops
23
+ if (lstatSync(fullPath).isSymbolicLink())
24
+ continue;
25
+ const stat = statSync(fullPath);
26
+ if (stat.isDirectory() && !entry.startsWith('.') && entry !== 'node_modules') {
27
+ walk(fullPath, depth + 1);
28
+ }
29
+ else if (stat.isFile() && (extname(entry) === '.mdx' || extname(entry) === '.md')) {
30
+ files.push(fullPath);
31
+ }
16
32
  }
17
- else if (stat.isFile() && (extname(entry) === '.mdx' || extname(entry) === '.md')) {
18
- files.push(fullPath);
33
+ catch {
34
+ continue;
19
35
  }
20
36
  }
21
37
  }
22
- walk(dir);
38
+ walk(dir, 0);
23
39
  return files;
24
40
  }
25
41
  /**
@@ -31,3 +47,36 @@ export function slugify(str) {
31
47
  .replace(/[^a-z0-9]+/g, '-')
32
48
  .replace(/^-|-$/g, '');
33
49
  }
50
+ /**
51
+ * Simple YAML frontmatter parser — splits on --- markers.
52
+ * Returns parsed key-value data and remaining content body.
53
+ */
54
+ export function parseFrontmatter(content) {
55
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
56
+ if (!match)
57
+ return { data: {}, content };
58
+ const yamlStr = match[1];
59
+ const body = match[2];
60
+ const data = {};
61
+ for (const line of yamlStr.split('\n')) {
62
+ const kvMatch = line.match(/^(\w[\w-]*)\s*:\s*(.*)$/);
63
+ if (!kvMatch)
64
+ continue;
65
+ const key = kvMatch[1];
66
+ let value = kvMatch[2].trim();
67
+ if (typeof value === 'string') {
68
+ if ((value.startsWith('"') && value.endsWith('"')) ||
69
+ (value.startsWith("'") && value.endsWith("'"))) {
70
+ value = value.slice(1, -1);
71
+ }
72
+ else if (value === 'true')
73
+ value = true;
74
+ else if (value === 'false')
75
+ value = false;
76
+ else if (/^\d+$/.test(value))
77
+ value = parseInt(value, 10);
78
+ }
79
+ data[key] = value;
80
+ }
81
+ return { data, content: body };
82
+ }
@@ -1,4 +1 @@
1
- export declare function validatePath(input: string, mustExist?: boolean): string;
2
1
  export declare function validateUrl(input: string): string;
3
- export declare function validateSlug(input: string): string;
4
- export declare function sanitizeForShell(input: string): string;
@@ -1,16 +1,3 @@
1
- import { existsSync } from 'fs';
2
- import { resolve } from 'path';
3
- export function validatePath(input, mustExist = true) {
4
- const resolved = resolve(input);
5
- // Prevent path traversal outside cwd
6
- if (!resolved.startsWith(process.cwd()) && !resolved.startsWith('/tmp')) {
7
- // Allow absolute paths but warn
8
- }
9
- if (mustExist && !existsSync(resolved)) {
10
- throw new Error(`Path does not exist: ${resolved}`);
11
- }
12
- return resolved;
13
- }
14
1
  export function validateUrl(input) {
15
2
  try {
16
3
  const url = new URL(input);
@@ -23,16 +10,3 @@ export function validateUrl(input) {
23
10
  throw new Error(`Invalid URL: ${input}`);
24
11
  }
25
12
  }
26
- export function validateSlug(input) {
27
- if (!/^[a-zA-Z0-9_-]+$/.test(input)) {
28
- throw new Error(`Invalid slug: ${input}. Only alphanumeric, hyphens, and underscores allowed.`);
29
- }
30
- return input;
31
- }
32
- export function sanitizeForShell(input) {
33
- // Only allow safe characters for git refs, filenames, etc.
34
- if (!/^[a-zA-Z0-9/_~.^@{}-]+$/.test(input)) {
35
- throw new Error(`Unsafe characters in input: ${input}`);
36
- }
37
- return input;
38
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skrypt-ai",
3
- "version": "0.4.2",
3
+ "version": "0.6.0",
4
4
  "description": "AI-powered documentation generator with code examples",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",
@@ -54,6 +54,10 @@
54
54
  "openai": "^6.27.0",
55
55
  "typescript": "^5.9.3"
56
56
  },
57
+ "optionalDependencies": {
58
+ "@napi-rs/keyring": "^1.1.6",
59
+ "playwright": "^1.52.0"
60
+ },
57
61
  "devDependencies": {
58
62
  "@eslint/js": "^10.0.1",
59
63
  "@types/js-yaml": "^4.0.9",