@respeak/recap 0.3.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 (94) hide show
  1. package/dist/src/ai/gemini.d.ts +10 -0
  2. package/dist/src/ai/gemini.js +76 -0
  3. package/dist/src/ai/gemini.js.map +1 -0
  4. package/dist/src/ai/pipeline.d.ts +26 -0
  5. package/dist/src/ai/pipeline.js +37 -0
  6. package/dist/src/ai/pipeline.js.map +1 -0
  7. package/dist/src/ai/prompts.d.ts +9 -0
  8. package/dist/src/ai/prompts.js +129 -0
  9. package/dist/src/ai/prompts.js.map +1 -0
  10. package/dist/src/analyze/index.d.ts +11 -0
  11. package/dist/src/analyze/index.js +55 -0
  12. package/dist/src/analyze/index.js.map +1 -0
  13. package/dist/src/analyze/plan-schema.d.ts +180 -0
  14. package/dist/src/analyze/plan-schema.js +91 -0
  15. package/dist/src/analyze/plan-schema.js.map +1 -0
  16. package/dist/src/analyze/scanners/generic.d.ts +2 -0
  17. package/dist/src/analyze/scanners/generic.js +44 -0
  18. package/dist/src/analyze/scanners/generic.js.map +1 -0
  19. package/dist/src/analyze/scanners/nextjs.d.ts +11 -0
  20. package/dist/src/analyze/scanners/nextjs.js +84 -0
  21. package/dist/src/analyze/scanners/nextjs.js.map +1 -0
  22. package/dist/src/download.d.ts +2 -0
  23. package/dist/src/download.js +36 -0
  24. package/dist/src/download.js.map +1 -0
  25. package/dist/src/index.d.ts +2 -0
  26. package/dist/src/index.js +330 -0
  27. package/dist/src/index.js.map +1 -0
  28. package/dist/src/output/markdown.d.ts +2 -0
  29. package/dist/src/output/markdown.js +25 -0
  30. package/dist/src/output/markdown.js.map +1 -0
  31. package/dist/src/output/mdx.d.ts +2 -0
  32. package/dist/src/output/mdx.js +31 -0
  33. package/dist/src/output/mdx.js.map +1 -0
  34. package/dist/src/produce/docs-generator.d.ts +11 -0
  35. package/dist/src/produce/docs-generator.js +63 -0
  36. package/dist/src/produce/docs-generator.js.map +1 -0
  37. package/dist/src/produce/index.d.ts +7 -0
  38. package/dist/src/produce/index.js +76 -0
  39. package/dist/src/produce/index.js.map +1 -0
  40. package/dist/src/produce/merge.d.ts +16 -0
  41. package/dist/src/produce/merge.js +66 -0
  42. package/dist/src/produce/merge.js.map +1 -0
  43. package/dist/src/produce/translate.d.ts +2 -0
  44. package/dist/src/produce/translate.js +23 -0
  45. package/dist/src/produce/translate.js.map +1 -0
  46. package/dist/src/produce/tts/elevenlabs.d.ts +4 -0
  47. package/dist/src/produce/tts/elevenlabs.js +34 -0
  48. package/dist/src/produce/tts/elevenlabs.js.map +1 -0
  49. package/dist/src/produce/tts/google.d.ts +4 -0
  50. package/dist/src/produce/tts/google.js +30 -0
  51. package/dist/src/produce/tts/google.js.map +1 -0
  52. package/dist/src/produce/tts/interface.d.ts +9 -0
  53. package/dist/src/produce/tts/interface.js +2 -0
  54. package/dist/src/produce/tts/interface.js.map +1 -0
  55. package/dist/src/produce/tts/openai.d.ts +4 -0
  56. package/dist/src/produce/tts/openai.js +29 -0
  57. package/dist/src/produce/tts/openai.js.map +1 -0
  58. package/dist/src/produce/tts/registry.d.ts +2 -0
  59. package/dist/src/produce/tts/registry.js +16 -0
  60. package/dist/src/produce/tts/registry.js.map +1 -0
  61. package/dist/src/record/action-translator.d.ts +28 -0
  62. package/dist/src/record/action-translator.js +100 -0
  63. package/dist/src/record/action-translator.js.map +1 -0
  64. package/dist/src/record/browser-session.d.ts +12 -0
  65. package/dist/src/record/browser-session.js +129 -0
  66. package/dist/src/record/browser-session.js.map +1 -0
  67. package/dist/src/record/index.d.ts +9 -0
  68. package/dist/src/record/index.js +88 -0
  69. package/dist/src/record/index.js.map +1 -0
  70. package/dist/src/sync/client.d.ts +95 -0
  71. package/dist/src/sync/client.js +90 -0
  72. package/dist/src/sync/client.js.map +1 -0
  73. package/dist/src/sync/diff.d.ts +31 -0
  74. package/dist/src/sync/diff.js +236 -0
  75. package/dist/src/sync/diff.js.map +1 -0
  76. package/dist/src/sync/image-dimensions.d.ts +9 -0
  77. package/dist/src/sync/image-dimensions.js +48 -0
  78. package/dist/src/sync/image-dimensions.js.map +1 -0
  79. package/dist/src/sync/index.d.ts +21 -0
  80. package/dist/src/sync/index.js +141 -0
  81. package/dist/src/sync/index.js.map +1 -0
  82. package/dist/src/sync/links.d.ts +25 -0
  83. package/dist/src/sync/links.js +61 -0
  84. package/dist/src/sync/links.js.map +1 -0
  85. package/dist/src/sync/manifest.d.ts +97 -0
  86. package/dist/src/sync/manifest.js +156 -0
  87. package/dist/src/sync/manifest.js.map +1 -0
  88. package/dist/src/sync/markdown.d.ts +29 -0
  89. package/dist/src/sync/markdown.js +73 -0
  90. package/dist/src/sync/markdown.js.map +1 -0
  91. package/dist/src/sync/payload.d.ts +44 -0
  92. package/dist/src/sync/payload.js +74 -0
  93. package/dist/src/sync/payload.js.map +1 -0
  94. package/package.json +68 -0
@@ -0,0 +1,97 @@
1
+ import { z } from "zod/v4";
2
+ export declare const DEFAULT_LANGUAGE = "en";
3
+ export declare const MANIFEST_FILENAME = "sync.json";
4
+ export declare const ProjectTranslationSchema: z.ZodObject<{
5
+ name: z.ZodOptional<z.ZodString>;
6
+ subtitle: z.ZodOptional<z.ZodString>;
7
+ }, z.core.$strip>;
8
+ export declare const ChapterTranslationSchema: z.ZodObject<{
9
+ title: z.ZodOptional<z.ZodString>;
10
+ group: z.ZodOptional<z.ZodString>;
11
+ description: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ export declare const ArticleLangSchema: z.ZodObject<{
14
+ title: z.ZodString;
15
+ file: z.ZodString;
16
+ description: z.ZodOptional<z.ZodString>;
17
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
18
+ }, z.core.$strip>;
19
+ export type ArticleLang = z.infer<typeof ArticleLangSchema>;
20
+ export declare const ArticleSchema: z.ZodObject<{
21
+ slug: z.ZodString;
22
+ }, z.core.$catchall<z.ZodUnknown>>;
23
+ export type Article = z.infer<typeof ArticleSchema>;
24
+ export declare const ChapterSchema: z.ZodObject<{
25
+ slug: z.ZodString;
26
+ title: z.ZodString;
27
+ group: z.ZodOptional<z.ZodString>;
28
+ order: z.ZodOptional<z.ZodNumber>;
29
+ description: z.ZodOptional<z.ZodString>;
30
+ content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
31
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
+ translations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
33
+ title: z.ZodOptional<z.ZodString>;
34
+ group: z.ZodOptional<z.ZodString>;
35
+ description: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>>>;
37
+ articles: z.ZodDefault<z.ZodArray<z.ZodObject<{
38
+ slug: z.ZodString;
39
+ }, z.core.$catchall<z.ZodUnknown>>>>;
40
+ }, z.core.$strip>;
41
+ export type Chapter = z.infer<typeof ChapterSchema>;
42
+ export declare const SyncManifestSchema: z.ZodObject<{
43
+ project_slug: z.ZodString;
44
+ languages: z.ZodDefault<z.ZodArray<z.ZodString>>;
45
+ name: z.ZodOptional<z.ZodString>;
46
+ subtitle: z.ZodOptional<z.ZodString>;
47
+ translations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
48
+ name: z.ZodOptional<z.ZodString>;
49
+ subtitle: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>>>;
51
+ chapters: z.ZodArray<z.ZodObject<{
52
+ slug: z.ZodString;
53
+ title: z.ZodString;
54
+ group: z.ZodOptional<z.ZodString>;
55
+ order: z.ZodOptional<z.ZodNumber>;
56
+ description: z.ZodOptional<z.ZodString>;
57
+ content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
58
+ keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
+ translations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
60
+ title: z.ZodOptional<z.ZodString>;
61
+ group: z.ZodOptional<z.ZodString>;
62
+ description: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>>>;
64
+ articles: z.ZodDefault<z.ZodArray<z.ZodObject<{
65
+ slug: z.ZodString;
66
+ }, z.core.$catchall<z.ZodUnknown>>>>;
67
+ }, z.core.$strip>>;
68
+ }, z.core.$strip>;
69
+ export type SyncManifest = z.infer<typeof SyncManifestSchema>;
70
+ export declare function manifestPath(docsDir: string): string;
71
+ export declare function loadManifest(docsDir: string): Promise<SyncManifest>;
72
+ export declare function parseManifest(raw: string): SyncManifest;
73
+ export type ArticleLangResult = {
74
+ ok: true;
75
+ value: ArticleLang;
76
+ } | {
77
+ ok: false;
78
+ error: string;
79
+ };
80
+ /**
81
+ * Resolve a language variant of an article. Returns null when the language is
82
+ * not present on the article (a normal case — not every article exists in every
83
+ * language), or a validation result describing the per-language object.
84
+ */
85
+ export declare function getArticleLang(article: Article, lang: string): ArticleLangResult | null;
86
+ export interface ValidationReport {
87
+ errors: string[];
88
+ warnings: string[];
89
+ }
90
+ /**
91
+ * Check the manifest against the actual docs folder:
92
+ * - every referenced markdown file exists (error)
93
+ * - orphan `.md` files under each language dir that are not referenced (warning)
94
+ * - per-language article objects are well-formed (error)
95
+ * Mirrors the reference `validate()`.
96
+ */
97
+ export declare function validateManifest(manifest: SyncManifest, docsDir: string): ValidationReport;
@@ -0,0 +1,156 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { existsSync, readdirSync } from "node:fs";
3
+ import path from "node:path";
4
+ import { z } from "zod/v4";
5
+ // The default language. Top-level chapter `content` and the project default
6
+ // are served in this language on the docs site; other languages are carried as
7
+ // translations. Matches the server's `language ?? "en"` default.
8
+ export const DEFAULT_LANGUAGE = "en";
9
+ export const MANIFEST_FILENAME = "sync.json";
10
+ // --- Schema ---
11
+ export const ProjectTranslationSchema = z.object({
12
+ name: z.string().optional(),
13
+ subtitle: z.string().optional(),
14
+ });
15
+ export const ChapterTranslationSchema = z.object({
16
+ title: z.string().optional(),
17
+ group: z.string().optional(),
18
+ description: z.string().optional(),
19
+ });
20
+ export const ArticleLangSchema = z.object({
21
+ title: z.string(),
22
+ file: z.string(),
23
+ description: z.string().optional(),
24
+ keywords: z.array(z.string()).optional(),
25
+ });
26
+ // An article has a shared `slug` plus one object per language (keyed by language
27
+ // code). Language entries are validated structurally in `validateManifest`
28
+ // (and lazily via `getArticleLang`), so the schema only pins `slug` and lets the
29
+ // per-language objects pass through.
30
+ export const ArticleSchema = z.object({ slug: z.string() }).catchall(z.unknown());
31
+ export const ChapterSchema = z.object({
32
+ slug: z.string(),
33
+ title: z.string(),
34
+ group: z.string().optional(),
35
+ order: z.number().optional(),
36
+ description: z.string().optional(),
37
+ // language code -> repo-relative path to the chapter's `_index.md`
38
+ content: z.record(z.string(), z.string()).optional(),
39
+ keywords: z.array(z.string()).optional(),
40
+ translations: z.record(z.string(), ChapterTranslationSchema).optional(),
41
+ articles: z.array(ArticleSchema).default([]),
42
+ });
43
+ export const SyncManifestSchema = z.object({
44
+ project_slug: z.string(),
45
+ languages: z.array(z.string()).default(["en", "de"]),
46
+ name: z.string().optional(),
47
+ subtitle: z.string().optional(),
48
+ translations: z.record(z.string(), ProjectTranslationSchema).optional(),
49
+ chapters: z.array(ChapterSchema),
50
+ });
51
+ // --- Loading ---
52
+ export function manifestPath(docsDir) {
53
+ return path.join(docsDir, MANIFEST_FILENAME);
54
+ }
55
+ export async function loadManifest(docsDir) {
56
+ const file = manifestPath(docsDir);
57
+ if (!existsSync(file)) {
58
+ throw new Error(`No ${MANIFEST_FILENAME} found in ${docsDir}`);
59
+ }
60
+ const raw = await readFile(file, "utf-8");
61
+ return parseManifest(raw);
62
+ }
63
+ export function parseManifest(raw) {
64
+ let json;
65
+ try {
66
+ json = JSON.parse(raw);
67
+ }
68
+ catch (err) {
69
+ throw new Error(`${MANIFEST_FILENAME} is not valid JSON: ${err.message}`);
70
+ }
71
+ const result = SyncManifestSchema.safeParse(json);
72
+ if (!result.success) {
73
+ const issues = result.error.issues
74
+ .map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`)
75
+ .join("\n");
76
+ throw new Error(`${MANIFEST_FILENAME} failed validation:\n${issues}`);
77
+ }
78
+ return result.data;
79
+ }
80
+ /**
81
+ * Resolve a language variant of an article. Returns null when the language is
82
+ * not present on the article (a normal case — not every article exists in every
83
+ * language), or a validation result describing the per-language object.
84
+ */
85
+ export function getArticleLang(article, lang) {
86
+ const entry = article[lang];
87
+ if (entry === undefined)
88
+ return null;
89
+ const parsed = ArticleLangSchema.safeParse(entry);
90
+ if (!parsed.success) {
91
+ return { ok: false, error: parsed.error.issues.map((i) => i.message).join(", ") };
92
+ }
93
+ return { ok: true, value: parsed.data };
94
+ }
95
+ /**
96
+ * Check the manifest against the actual docs folder:
97
+ * - every referenced markdown file exists (error)
98
+ * - orphan `.md` files under each language dir that are not referenced (warning)
99
+ * - per-language article objects are well-formed (error)
100
+ * Mirrors the reference `validate()`.
101
+ */
102
+ export function validateManifest(manifest, docsDir) {
103
+ const errors = [];
104
+ const warnings = [];
105
+ const referenced = new Set();
106
+ for (const chapter of manifest.chapters) {
107
+ for (const [lang, rel] of Object.entries(chapter.content ?? {})) {
108
+ referenced.add(rel);
109
+ if (!existsSync(path.join(docsDir, rel))) {
110
+ errors.push(`Missing file: ${rel} (chapter '${chapter.slug}' ${lang} content)`);
111
+ }
112
+ }
113
+ for (const article of chapter.articles) {
114
+ for (const lang of manifest.languages) {
115
+ const got = getArticleLang(article, lang);
116
+ if (got === null)
117
+ continue;
118
+ if (!got.ok) {
119
+ errors.push(`Invalid article '${article.slug}' (${lang}): ${got.error}`);
120
+ continue;
121
+ }
122
+ const rel = got.value.file;
123
+ referenced.add(rel);
124
+ if (!existsSync(path.join(docsDir, rel))) {
125
+ errors.push(`Missing file: ${rel} (article '${article.slug}' ${lang})`);
126
+ }
127
+ }
128
+ }
129
+ }
130
+ for (const langDir of manifest.languages) {
131
+ const base = path.join(docsDir, langDir);
132
+ if (!existsSync(base))
133
+ continue;
134
+ for (const abs of walkMarkdown(base)) {
135
+ const rel = path.relative(docsDir, abs).split(path.sep).join("/");
136
+ if (!referenced.has(rel)) {
137
+ warnings.push(`Orphaned file (not in ${MANIFEST_FILENAME}): ${rel}`);
138
+ }
139
+ }
140
+ }
141
+ return { errors, warnings };
142
+ }
143
+ function walkMarkdown(dir) {
144
+ const out = [];
145
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
146
+ const abs = path.join(dir, entry.name);
147
+ if (entry.isDirectory()) {
148
+ out.push(...walkMarkdown(abs));
149
+ }
150
+ else if (entry.isFile() && entry.name.toLowerCase().endsWith(".md")) {
151
+ out.push(abs);
152
+ }
153
+ }
154
+ return out.sort();
155
+ }
156
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/sync/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,4EAA4E;AAC5E,+EAA+E;AAC/E,iEAAiE;AACjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAErC,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE7C,iBAAiB;AAEjB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,M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AI,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QACjC,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACtE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { type LinkMap } from "./links.js";
2
+ /** Strip the leading H1 — the title comes from the manifest, not the file. */
3
+ export declare function stripH1(content: string): string;
4
+ /** Replace `media/<filename>` references with their uploaded URLs. */
5
+ export declare function swapMediaUrls(content: string, imageUrls: Record<string, string>): string;
6
+ /**
7
+ * Prepare a markdown file for sync: strip the H1, rewrite relative `.md`
8
+ * cross-links to public slug URLs, then swap local media paths for uploaded
9
+ * URLs. Order matters (H1 first, then links, then media), mirroring the
10
+ * reference client.
11
+ */
12
+ export declare function processMarkdown(content: string, relPath: string, linkMap: LinkMap, projectSlug: string, imageUrls: Record<string, string>, onWarn?: (message: string) => void): string;
13
+ /**
14
+ * Approximate the server's plain-text rendering (`content_text`) of a markdown
15
+ * file, for the diff word-overlap check. Strips the H1, collapses links and
16
+ * images to their visible text/alt, removes markdown/custom-block/HTML markers,
17
+ * and collapses whitespace. Mirrors the reference `read_local_md` +
18
+ * `extract_plain_text`.
19
+ */
20
+ export declare function toPlainText(content: string): string;
21
+ /**
22
+ * Tokenize text into a set of lowercased word tokens. Unicode-aware
23
+ * (`\p{L}\p{N}`) so umlauts and other letters count — JS `\w` does not match
24
+ * them. This is why leftover markup punctuation (table pipes, list dashes,
25
+ * code fences) does not register as a content difference.
26
+ */
27
+ export declare function tokenize(text: string): Set<string>;
28
+ /** Word-overlap ratio between two texts: |A ∩ B| / max(|A|, |B|). */
29
+ export declare function wordOverlap(a: string, b: string): number;
@@ -0,0 +1,73 @@
1
+ import { rewriteInternalLinks } from "./links.js";
2
+ /** Strip the leading H1 — the title comes from the manifest, not the file. */
3
+ export function stripH1(content) {
4
+ return content.replace(/^#\s+.+\n*/, "");
5
+ }
6
+ /** Replace `media/<filename>` references with their uploaded URLs. */
7
+ export function swapMediaUrls(content, imageUrls) {
8
+ let out = content;
9
+ for (const [filename, url] of Object.entries(imageUrls)) {
10
+ out = out.split(`media/${filename}`).join(url);
11
+ }
12
+ return out;
13
+ }
14
+ /**
15
+ * Prepare a markdown file for sync: strip the H1, rewrite relative `.md`
16
+ * cross-links to public slug URLs, then swap local media paths for uploaded
17
+ * URLs. Order matters (H1 first, then links, then media), mirroring the
18
+ * reference client.
19
+ */
20
+ export function processMarkdown(content, relPath, linkMap, projectSlug, imageUrls, onWarn) {
21
+ let out = stripH1(content);
22
+ out = rewriteInternalLinks(out, relPath, linkMap, projectSlug, onWarn);
23
+ out = swapMediaUrls(out, imageUrls);
24
+ return out.trim();
25
+ }
26
+ /**
27
+ * Approximate the server's plain-text rendering (`content_text`) of a markdown
28
+ * file, for the diff word-overlap check. Strips the H1, collapses links and
29
+ * images to their visible text/alt, removes markdown/custom-block/HTML markers,
30
+ * and collapses whitespace. Mirrors the reference `read_local_md` +
31
+ * `extract_plain_text`.
32
+ */
33
+ export function toPlainText(content) {
34
+ let text = stripH1(content);
35
+ // Collapse links and images to their visible text/alt.
36
+ text = text.replace(/!?\[([^\]]+)\]\([^)]*\)/g, "$1");
37
+ // Heading markers.
38
+ text = text.replace(/^#{1,6}\s+/gm, "");
39
+ // Bold / italic markers.
40
+ text = text.replace(/\*{1,3}([^*]+)\*{1,3}/g, "$1");
41
+ // Inline code.
42
+ text = text.replace(/`([^`]+)`/g, "$1");
43
+ // Custom-block fences (`:::steps`, `::tab{...}`, etc.).
44
+ text = text.replace(/^::.*$/gm, "");
45
+ // HTML tags.
46
+ text = text.replace(/<[^>]+>/g, "");
47
+ // Collapse whitespace.
48
+ text = text.replace(/\s+/g, " ");
49
+ return text.trim();
50
+ }
51
+ /**
52
+ * Tokenize text into a set of lowercased word tokens. Unicode-aware
53
+ * (`\p{L}\p{N}`) so umlauts and other letters count — JS `\w` does not match
54
+ * them. This is why leftover markup punctuation (table pipes, list dashes,
55
+ * code fences) does not register as a content difference.
56
+ */
57
+ export function tokenize(text) {
58
+ const matches = text.toLowerCase().match(/[\p{L}\p{N}_]+/gu) ?? [];
59
+ return new Set(matches);
60
+ }
61
+ /** Word-overlap ratio between two texts: |A ∩ B| / max(|A|, |B|). */
62
+ export function wordOverlap(a, b) {
63
+ const sa = tokenize(a);
64
+ const sb = tokenize(b);
65
+ if (sa.size === 0 || sb.size === 0)
66
+ return 0;
67
+ let inter = 0;
68
+ for (const w of sa)
69
+ if (sb.has(w))
70
+ inter++;
71
+ return inter / Math.max(sa.size, sb.size);
72
+ }
73
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../../src/sync/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAgB,MAAM,YAAY,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,SAAiC;IAC9E,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,KAAK,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACxD,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IACD,OAAO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AM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;IACnE,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS;IAC9C,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC7C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,KAAK,EAAE,CAAC;IAC3C,OAAO,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { type SyncManifest } from "./manifest.js";
2
+ import type { LinkMap } from "./links.js";
3
+ export interface SyncArticlePayload {
4
+ slug: string;
5
+ title: string;
6
+ content: string;
7
+ language: string;
8
+ status: string;
9
+ description?: string;
10
+ keywords?: string[];
11
+ }
12
+ export interface SyncChapterPayload {
13
+ slug: string;
14
+ title: string;
15
+ description: string;
16
+ group: string;
17
+ content?: string;
18
+ keywords?: string[];
19
+ translations: Record<string, {
20
+ title?: string;
21
+ group?: string;
22
+ description?: string;
23
+ content?: string;
24
+ }>;
25
+ articles: SyncArticlePayload[];
26
+ }
27
+ export interface SyncPayload {
28
+ name?: string;
29
+ subtitle?: string;
30
+ translations?: Record<string, {
31
+ name?: string;
32
+ subtitle?: string;
33
+ }>;
34
+ chapters: SyncChapterPayload[];
35
+ }
36
+ /**
37
+ * Build the declarative sync payload from the manifest. Chapters are sorted by
38
+ * `order`; the default-language chapter `_index` becomes the top-level
39
+ * `content` (persisted inline by the fixed `/sync` endpoint), other languages
40
+ * become `translations.<lang>.content`. Articles are emitted one entry per
41
+ * language, published. All markdown is H1-stripped, cross-link-rewritten and
42
+ * media-swapped via `processMarkdown`.
43
+ */
44
+ export declare function buildPayload(manifest: SyncManifest, docsDir: string, imageUrls: Record<string, string>, linkMap: LinkMap, onWarn?: (message: string) => void): Promise<SyncPayload>;
@@ -0,0 +1,74 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { DEFAULT_LANGUAGE, getArticleLang } from "./manifest.js";
4
+ import { processMarkdown } from "./markdown.js";
5
+ /**
6
+ * Build the declarative sync payload from the manifest. Chapters are sorted by
7
+ * `order`; the default-language chapter `_index` becomes the top-level
8
+ * `content` (persisted inline by the fixed `/sync` endpoint), other languages
9
+ * become `translations.<lang>.content`. Articles are emitted one entry per
10
+ * language, published. All markdown is H1-stripped, cross-link-rewritten and
11
+ * media-swapped via `processMarkdown`.
12
+ */
13
+ export async function buildPayload(manifest, docsDir, imageUrls, linkMap, onWarn) {
14
+ const read = async (relPath) => {
15
+ const raw = await readFile(path.join(docsDir, relPath), "utf-8");
16
+ return processMarkdown(raw, relPath, linkMap, manifest.project_slug, imageUrls, onWarn);
17
+ };
18
+ const payload = { chapters: [] };
19
+ if (manifest.name !== undefined)
20
+ payload.name = manifest.name;
21
+ if (manifest.subtitle !== undefined)
22
+ payload.subtitle = manifest.subtitle;
23
+ if (manifest.translations !== undefined)
24
+ payload.translations = manifest.translations;
25
+ const chapters = [...manifest.chapters].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
26
+ for (const chapter of chapters) {
27
+ const ch = {
28
+ slug: chapter.slug,
29
+ title: chapter.title,
30
+ description: chapter.description ?? "",
31
+ group: chapter.group ?? "",
32
+ translations: { ...(chapter.translations ?? {}) },
33
+ articles: [],
34
+ };
35
+ if (chapter.keywords !== undefined)
36
+ ch.keywords = chapter.keywords;
37
+ // Chapter content: default language inline, others via translations.
38
+ for (const [lang, relPath] of Object.entries(chapter.content ?? {})) {
39
+ const processed = await read(relPath);
40
+ if (!processed)
41
+ continue;
42
+ if (lang === DEFAULT_LANGUAGE) {
43
+ ch.content = processed;
44
+ }
45
+ else {
46
+ ch.translations[lang] = { ...(ch.translations[lang] ?? {}), content: processed };
47
+ }
48
+ }
49
+ // Articles: one entry per language variant.
50
+ for (const article of chapter.articles) {
51
+ for (const lang of manifest.languages) {
52
+ const got = getArticleLang(article, lang);
53
+ if (!got || !got.ok)
54
+ continue;
55
+ const entry = got.value;
56
+ const art = {
57
+ slug: article.slug,
58
+ title: entry.title,
59
+ content: await read(entry.file),
60
+ language: lang,
61
+ status: "published",
62
+ };
63
+ if (entry.description)
64
+ art.description = entry.description;
65
+ if (entry.keywords !== undefined)
66
+ art.keywords = entry.keywords;
67
+ ch.articles.push(art);
68
+ }
69
+ }
70
+ payload.chapters.push(ch);
71
+ }
72
+ return payload;
73
+ }
74
+ //# sourceMappingURL=payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload.js","sourceRoot":"","sources":["../../../src/sync/payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA+BhD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAsB,EACtB,OAAe,EACf,SAAiC,EACjC,OAAgB,EAChB,MAAkC;IAElC,MAAM,IAAI,GAAG,KAAK,EAAE,OAAe,EAAmB,EAAE;QACtD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC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CAAC;gBAChE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QAED,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@respeak/recap",
3
+ "version": "0.3.0",
4
+ "description": "Generate documentation from product videos",
5
+ "bin": {
6
+ "recap": "./dist/src/index.js"
7
+ },
8
+ "type": "module",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "engines": {
13
+ "node": ">=18"
14
+ },
15
+ "exports": {
16
+ ".": "./dist/src/ai/pipeline.js",
17
+ "./ai": "./dist/src/ai/gemini.js",
18
+ "./prompts": "./dist/src/ai/prompts.js",
19
+ "./analyze": "./dist/src/analyze/index.js",
20
+ "./record": "./dist/src/record/index.js",
21
+ "./produce": "./dist/src/produce/index.js",
22
+ "./plan": "./dist/src/analyze/plan-schema.js",
23
+ "./sync": "./dist/src/sync/index.js"
24
+ },
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "dev": "tsc --watch",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest",
30
+ "prepublishOnly": "tsc"
31
+ },
32
+ "files": [
33
+ "dist/src"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/respeak-io/recap.git",
38
+ "directory": "packages/cli"
39
+ },
40
+ "homepage": "https://github.com/respeak-io/recap#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/respeak-io/recap/issues"
43
+ },
44
+ "keywords": [
45
+ "documentation",
46
+ "video",
47
+ "ai",
48
+ "docs",
49
+ "generator",
50
+ "cli"
51
+ ],
52
+ "license": "AGPL-3.0",
53
+ "dependencies": {
54
+ "@google/genai": "^1.40.0",
55
+ "commander": "^13.0.0",
56
+ "js-yaml": "^4.1.1",
57
+ "marked": "^17.0.1",
58
+ "ora": "^8.0.0",
59
+ "playwright": "^1.58.2",
60
+ "zod": "^4.3.6"
61
+ },
62
+ "devDependencies": {
63
+ "@types/js-yaml": "^4.0.9",
64
+ "@types/node": "^20",
65
+ "typescript": "^5",
66
+ "vitest": "^4.1.0"
67
+ }
68
+ }