@lon-ask/dockit 0.1.1 → 0.1.4
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/LICENSE +21 -674
- package/README.md +618 -328
- package/SKILL.md +61 -110
- package/apps/client/dist/assets/{index-CqOXxsEZ.js → index-DzadxeQH.js} +2 -2
- package/apps/client/dist/index.html +1 -1
- package/apps/client/index.html +12 -0
- package/apps/client/package.json +26 -0
- package/apps/client/src/App.tsx +18 -0
- package/apps/client/src/api/client.ts +54 -0
- package/apps/client/src/components/BuildPanel.tsx +77 -0
- package/apps/client/src/components/DocViewer.tsx +76 -0
- package/apps/client/src/components/EntryDetail.tsx +322 -0
- package/apps/client/src/components/EntryForm.tsx +117 -0
- package/apps/client/src/components/EntryList.tsx +165 -0
- package/apps/client/src/components/GlobalSearchBar.tsx +166 -0
- package/apps/client/src/components/Layout.tsx +57 -0
- package/apps/client/src/components/SearchBar.tsx +103 -0
- package/apps/client/src/components/SourceForm.tsx +497 -0
- package/apps/client/src/hooks/useTheme.ts +19 -0
- package/apps/client/src/index.css +77 -0
- package/apps/client/src/main.tsx +13 -0
- package/apps/client/src/types.ts +105 -0
- package/apps/client/vite.config.ts +13 -0
- package/apps/server/dist/core/domain/entry.js +20 -0
- package/apps/server/dist/core/domain/entry.js.map +1 -0
- package/apps/server/dist/core/domain/errors.js +33 -0
- package/apps/server/dist/core/domain/errors.js.map +1 -0
- package/apps/server/dist/core/domain/knowledge-graph.js +2 -0
- package/apps/server/dist/core/domain/knowledge-graph.js.map +1 -0
- package/apps/server/dist/core/domain/types.js +2 -0
- package/apps/server/dist/core/domain/types.js.map +1 -0
- package/apps/server/dist/core/ports/IBuildRepository.js +2 -0
- package/apps/server/dist/core/ports/IBuildRepository.js.map +1 -0
- package/apps/server/dist/core/ports/IDocumentNormalizer.js +2 -0
- package/apps/server/dist/core/ports/IDocumentNormalizer.js.map +1 -0
- package/apps/server/dist/core/ports/IDocumentStore.js +2 -0
- package/apps/server/dist/core/ports/IDocumentStore.js.map +1 -0
- package/apps/server/dist/core/ports/IEntryReadModel.js +2 -0
- package/apps/server/dist/core/ports/IEntryReadModel.js.map +1 -0
- package/apps/server/dist/core/ports/IEntryRepository.js +2 -0
- package/apps/server/dist/core/ports/IEntryRepository.js.map +1 -0
- package/apps/server/dist/core/ports/IKnowledgeGraph.js +2 -0
- package/apps/server/dist/core/ports/IKnowledgeGraph.js.map +1 -0
- package/apps/server/dist/core/ports/IPathResolver.js +2 -0
- package/apps/server/dist/core/ports/IPathResolver.js.map +1 -0
- package/apps/server/dist/core/ports/ISearchEngine.js +2 -0
- package/apps/server/dist/core/ports/ISearchEngine.js.map +1 -0
- package/apps/server/dist/core/ports/ISourceProcessor.js +2 -0
- package/apps/server/dist/core/ports/ISourceProcessor.js.map +1 -0
- package/apps/server/dist/core/ports/ISourceRepository.js +2 -0
- package/apps/server/dist/core/ports/ISourceRepository.js.map +1 -0
- package/apps/server/dist/core/usecases/BuildUseCase.js +76 -0
- package/apps/server/dist/core/usecases/BuildUseCase.js.map +1 -0
- package/apps/server/dist/core/usecases/ConfigUseCase.js +62 -0
- package/apps/server/dist/core/usecases/ConfigUseCase.js.map +1 -0
- package/apps/server/dist/core/usecases/SearchUseCase.js +17 -0
- package/apps/server/dist/core/usecases/SearchUseCase.js.map +1 -0
- package/apps/server/dist/index.js +86 -0
- package/apps/server/dist/index.js.map +1 -0
- package/apps/server/dist/infrastructure/filesystem/FileSystemDocumentStore.js +25 -0
- package/apps/server/dist/infrastructure/filesystem/FileSystemDocumentStore.js.map +1 -0
- package/apps/server/dist/infrastructure/graph/GraphSearchDecorator.js +42 -0
- package/apps/server/dist/infrastructure/graph/GraphSearchDecorator.js.map +1 -0
- package/apps/server/dist/infrastructure/graph/GraphifyKnowledgeGraph.js +145 -0
- package/apps/server/dist/infrastructure/graph/GraphifyKnowledgeGraph.js.map +1 -0
- package/apps/server/dist/infrastructure/graph/index.js +3 -0
- package/apps/server/dist/infrastructure/graph/index.js.map +1 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteBuildRepository.js +21 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteBuildRepository.js.map +1 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryReadModel.js +11 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryReadModel.js.map +1 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryRepository.js +59 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteEntryRepository.js.map +1 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteSourceRepository.js +47 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/SqliteSourceRepository.js.map +1 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/connection.js +50 -0
- package/apps/server/dist/infrastructure/persistence/sqlite/connection.js.map +1 -0
- package/apps/server/dist/infrastructure/search/SearchEngineFactory.js +32 -0
- package/apps/server/dist/infrastructure/search/SearchEngineFactory.js.map +1 -0
- package/apps/server/dist/infrastructure/search/json/JsonSearchEngine.js +147 -0
- package/apps/server/dist/infrastructure/search/json/JsonSearchEngine.js.map +1 -0
- package/apps/server/dist/infrastructure/search/vector/EmbeddingService.js +23 -0
- package/apps/server/dist/infrastructure/search/vector/EmbeddingService.js.map +1 -0
- package/apps/server/dist/infrastructure/search/vector/VectorSearchEngine.js +378 -0
- package/apps/server/dist/infrastructure/search/vector/VectorSearchEngine.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/AntoraSourceProcessor.js +11 -0
- package/apps/server/dist/infrastructure/source-processors/AntoraSourceProcessor.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/AsciidocSourceProcessor.js +9 -0
- package/apps/server/dist/infrastructure/source-processors/AsciidocSourceProcessor.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/DocumentNormalizer.js +11 -0
- package/apps/server/dist/infrastructure/source-processors/DocumentNormalizer.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/GithubMarkdownSourceProcessor.js +9 -0
- package/apps/server/dist/infrastructure/source-processors/GithubMarkdownSourceProcessor.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/MavenSourceProcessor.js +9 -0
- package/apps/server/dist/infrastructure/source-processors/MavenSourceProcessor.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/PathResolver.js +5 -0
- package/apps/server/dist/infrastructure/source-processors/PathResolver.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/SourceCodeSourceProcessor.js +269 -0
- package/apps/server/dist/infrastructure/source-processors/SourceCodeSourceProcessor.js.map +1 -0
- package/apps/server/dist/infrastructure/source-processors/ZipSourceProcessor.js +9 -0
- package/apps/server/dist/infrastructure/source-processors/ZipSourceProcessor.js.map +1 -0
- package/apps/server/dist/mcp-http.js +93 -0
- package/apps/server/dist/mcp-http.js.map +1 -0
- package/apps/server/dist/mcp.js +339 -0
- package/apps/server/dist/mcp.js.map +1 -0
- package/apps/server/dist/routes/build.js +89 -0
- package/apps/server/dist/routes/build.js.map +1 -0
- package/apps/server/dist/routes/entries.js +52 -0
- package/apps/server/dist/routes/entries.js.map +1 -0
- package/apps/server/dist/routes/graph.js +58 -0
- package/apps/server/dist/routes/graph.js.map +1 -0
- package/apps/server/dist/routes/search.js +24 -0
- package/apps/server/dist/routes/search.js.map +1 -0
- package/apps/server/dist/routes/sources.js +100 -0
- package/apps/server/dist/routes/sources.js.map +1 -0
- package/apps/server/dist/routes/viewer.js +22 -0
- package/apps/server/dist/routes/viewer.js.map +1 -0
- package/apps/server/dist/services/antora.js +222 -0
- package/apps/server/dist/services/antora.js.map +1 -0
- package/apps/server/dist/services/asciidoc.js +206 -0
- package/apps/server/dist/services/asciidoc.js.map +1 -0
- package/apps/server/dist/services/configLoader.js +150 -0
- package/apps/server/dist/services/configLoader.js.map +1 -0
- package/apps/server/dist/services/githubMarkdown.js +221 -0
- package/apps/server/dist/services/githubMarkdown.js.map +1 -0
- package/apps/server/dist/services/maven.js +148 -0
- package/apps/server/dist/services/maven.js.map +1 -0
- package/apps/server/dist/services/normalizer.js +42 -0
- package/apps/server/dist/services/normalizer.js.map +1 -0
- package/apps/server/dist/services/paths.js +5 -0
- package/apps/server/dist/services/paths.js.map +1 -0
- package/apps/server/dist/services/textExtractor.js +46 -0
- package/apps/server/dist/services/textExtractor.js.map +1 -0
- package/apps/server/dist/services/zip.js +63 -0
- package/apps/server/dist/services/zip.js.map +1 -0
- package/apps/server/package.json +38 -0
- package/apps/server/src/infrastructure/source-processors/SourceCodeSourceProcessor.ts +9 -2
- package/bin/commands/dev.ts +2 -2
- package/bin/commands/serve.ts +2 -2
- package/package.json +22 -4
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
const VALID_TYPES = ['zip', 'antora', 'maven', 'asciidoc', 'github-markdown', 'source-code'];
|
|
3
|
+
function validateConfig(type, config) {
|
|
4
|
+
switch (type) {
|
|
5
|
+
case 'maven':
|
|
6
|
+
if (!config.groupId || typeof config.groupId !== 'string')
|
|
7
|
+
return 'groupId is required';
|
|
8
|
+
if (!config.artifactId || typeof config.artifactId !== 'string')
|
|
9
|
+
return 'artifactId is required';
|
|
10
|
+
if (!config.version || typeof config.version !== 'string')
|
|
11
|
+
return 'version is required';
|
|
12
|
+
return null;
|
|
13
|
+
case 'zip': {
|
|
14
|
+
const hasUrl = config.url && typeof config.url === 'string';
|
|
15
|
+
const hasLocalPath = config.localPath && typeof config.localPath === 'string';
|
|
16
|
+
if (!hasUrl && !hasLocalPath)
|
|
17
|
+
return 'url or localPath is required';
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
case 'antora': {
|
|
21
|
+
const hasRepoUrl = config.repoUrl && typeof config.repoUrl === 'string';
|
|
22
|
+
const hasZipPath = config.zipPath && typeof config.zipPath === 'string';
|
|
23
|
+
const hasLocalPath = config.localPath && typeof config.localPath === 'string';
|
|
24
|
+
if (!hasRepoUrl && !hasZipPath && !hasLocalPath)
|
|
25
|
+
return 'repoUrl, localPath, or zipPath is required';
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
case 'asciidoc': {
|
|
29
|
+
const hasRepoUrl = config.repoUrl && typeof config.repoUrl === 'string';
|
|
30
|
+
const hasZipPath = config.zipPath && typeof config.zipPath === 'string';
|
|
31
|
+
const hasLocalPath = config.localPath && typeof config.localPath === 'string';
|
|
32
|
+
if (!hasRepoUrl && !hasZipPath && !hasLocalPath)
|
|
33
|
+
return 'repoUrl, localPath, or zipPath is required';
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
case 'github-markdown': {
|
|
37
|
+
const hasRepoUrl = config.repoUrl && typeof config.repoUrl === 'string';
|
|
38
|
+
const hasLocalPath = config.localPath && typeof config.localPath === 'string';
|
|
39
|
+
if (!hasRepoUrl && !hasLocalPath)
|
|
40
|
+
return 'repoUrl or localPath is required';
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
case 'source-code': {
|
|
44
|
+
const hasRepoUrl = config.repoUrl && typeof config.repoUrl === 'string';
|
|
45
|
+
const hasLocalPath = config.localPath && typeof config.localPath === 'string';
|
|
46
|
+
const hasZipPath = config.zipPath && typeof config.zipPath === 'string';
|
|
47
|
+
if (!hasRepoUrl && !hasLocalPath && !hasZipPath)
|
|
48
|
+
return 'repoUrl, localPath, or zipPath is required';
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function createSourceRoutes(configUseCase) {
|
|
56
|
+
const router = Router({ mergeParams: true });
|
|
57
|
+
router.post('/', async (req, res) => {
|
|
58
|
+
const entryId = req.params.entryId;
|
|
59
|
+
const entry = await configUseCase.getEntry(entryId);
|
|
60
|
+
if (!entry) {
|
|
61
|
+
res.status(404).json({ error: 'Entry not found' });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const { type, label, config } = req.body;
|
|
65
|
+
if (!type || !VALID_TYPES.includes(type)) {
|
|
66
|
+
res.status(400).json({ error: `type must be one of: ${VALID_TYPES.join(', ')}` });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (!label) {
|
|
70
|
+
res.status(400).json({ error: 'label is required' });
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const configError = validateConfig(type, config);
|
|
74
|
+
if (configError) {
|
|
75
|
+
res.status(400).json({ error: configError });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const source = await configUseCase.createSource(entryId, { type, label, config: config });
|
|
79
|
+
res.status(201).json(source);
|
|
80
|
+
});
|
|
81
|
+
return router;
|
|
82
|
+
}
|
|
83
|
+
export function createSourceFlatRoutes(configUseCase) {
|
|
84
|
+
const router = Router();
|
|
85
|
+
router.put('/:id', async (req, res) => {
|
|
86
|
+
const id = req.params.id;
|
|
87
|
+
const input = req.body;
|
|
88
|
+
await configUseCase.updateSource(id, input);
|
|
89
|
+
const { SqliteSourceRepository } = await import('../infrastructure/persistence/sqlite/SqliteSourceRepository.js');
|
|
90
|
+
const source = await new SqliteSourceRepository().findById(id);
|
|
91
|
+
res.json(source);
|
|
92
|
+
});
|
|
93
|
+
router.delete('/:id', async (req, res) => {
|
|
94
|
+
const id = req.params.id;
|
|
95
|
+
await configUseCase.deleteSource(id);
|
|
96
|
+
res.json({ success: true });
|
|
97
|
+
});
|
|
98
|
+
return router;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../src/routes/sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAIpD,MAAM,WAAW,GAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAE3G,SAAS,cAAc,CAAC,IAAgB,EAAE,MAA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A_ROOT } from '../services/paths.js';
|
|
5
|
+
const router = Router();
|
|
6
|
+
router.use('/bundle/:entryId', (req, res) => {
|
|
7
|
+
const entryId = req.params.entryId;
|
|
8
|
+
const filePath = req.path.replace(/^\//, '') || 'index.html';
|
|
9
|
+
const fullPath = path.resolve(DATA_ROOT, entryId, 'bundle', filePath);
|
|
10
|
+
const dataRoot = path.resolve(DATA_ROOT);
|
|
11
|
+
if (!fullPath.startsWith(dataRoot)) {
|
|
12
|
+
res.status(403).json({ error: 'Invalid document path' });
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!fs.existsSync(fullPath)) {
|
|
16
|
+
res.status(404).json({ error: 'Documentation not built yet' });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
res.sendFile(fullPath);
|
|
20
|
+
});
|
|
21
|
+
export default router;
|
|
22
|
+
//# sourceMappingURL=viewer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer.js","sourceRoot":"","sources":["../../src/routes/viewer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqB,MAAM,SAAS,CAAC;AAEpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAExB,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7D,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAiB,CAAC;IAC7C,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC;IAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEzC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,CAAC,CAAC;QACzD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,6BAA6B,EAAE,CAAC,CAAC;QAC/D,OAAO;IACT,CAAC;IAED,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { execSync, spawn } from 'node:child_process';
|
|
4
|
+
import { Readable } from 'node:stream';
|
|
5
|
+
import { pipeline } from 'node:stream/promises';
|
|
6
|
+
import unzipper from 'unzipper';
|
|
7
|
+
async function cloneRepo(repoUrl, targetDir, log) {
|
|
8
|
+
log(`Cloning repository ${repoUrl}`);
|
|
9
|
+
if (fs.existsSync(targetDir))
|
|
10
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const proc = spawn('git', ['clone', '--depth', '1', repoUrl, targetDir], {
|
|
13
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
14
|
+
});
|
|
15
|
+
let stderr = '';
|
|
16
|
+
proc.stderr?.on('data', (data) => {
|
|
17
|
+
stderr += data.toString();
|
|
18
|
+
const lines = data.toString().trim().split('\n');
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
if (line)
|
|
21
|
+
log(` git: ${line}`);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
proc.on('close', (code) => {
|
|
25
|
+
if (code === 0) {
|
|
26
|
+
log('Repository cloned successfully');
|
|
27
|
+
resolve();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
reject(new Error(`git clone failed with code ${code}: ${stderr}`));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
proc.on('error', reject);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function extractZip(zipPath, targetDir, log) {
|
|
37
|
+
log(`Extracting local ZIP from ${zipPath}`);
|
|
38
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
39
|
+
const data = fs.readFileSync(zipPath);
|
|
40
|
+
const stream = Readable.from(data);
|
|
41
|
+
await pipeline(stream, unzipper.Extract({ path: targetDir }));
|
|
42
|
+
const entries = fs.readdirSync(targetDir);
|
|
43
|
+
if (entries.length === 1 && fs.statSync(path.join(targetDir, entries[0])).isDirectory()) {
|
|
44
|
+
log('Detected single root directory in ZIP, flattening...');
|
|
45
|
+
const innerDir = path.join(targetDir, entries[0]);
|
|
46
|
+
const innerEntries = fs.readdirSync(innerDir);
|
|
47
|
+
for (const entry of innerEntries) {
|
|
48
|
+
const src = path.join(innerDir, entry);
|
|
49
|
+
const dest = path.join(targetDir, entry);
|
|
50
|
+
fs.renameSync(src, dest);
|
|
51
|
+
}
|
|
52
|
+
fs.rmdirSync(innerDir);
|
|
53
|
+
}
|
|
54
|
+
log(`Extracted ZIP to ${targetDir}`);
|
|
55
|
+
}
|
|
56
|
+
function findAntoraYmlFiles(dir) {
|
|
57
|
+
const results = [];
|
|
58
|
+
const stack = [dir];
|
|
59
|
+
while (stack.length > 0) {
|
|
60
|
+
const current = stack.pop();
|
|
61
|
+
const entries = fs.readdirSync(current, { withFileTypes: true });
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
if (entry.name.startsWith('.'))
|
|
64
|
+
continue;
|
|
65
|
+
if (entry.name === 'node_modules')
|
|
66
|
+
continue;
|
|
67
|
+
const fullPath = path.join(current, entry.name);
|
|
68
|
+
if (entry.isDirectory()) {
|
|
69
|
+
stack.push(fullPath);
|
|
70
|
+
}
|
|
71
|
+
else if (entry.name === 'antora.yml') {
|
|
72
|
+
results.push(fullPath);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return results;
|
|
77
|
+
}
|
|
78
|
+
function findExistingPlaybook(contentDir) {
|
|
79
|
+
const candidates = ['antora-playbook.yml', 'site.yml', 'antora-playbook.yaml', 'site.yaml'];
|
|
80
|
+
for (const name of candidates) {
|
|
81
|
+
const p = path.join(contentDir, name);
|
|
82
|
+
if (fs.existsSync(p))
|
|
83
|
+
return p;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
function generatePlaybook(entryId, contentDir, outputDir, startPaths, log) {
|
|
88
|
+
let sourcesYaml;
|
|
89
|
+
if (startPaths.length === 0) {
|
|
90
|
+
log(' No antora.yml files found — Antora will scan entire repository');
|
|
91
|
+
sourcesYaml = ` - url: ${contentDir}\n branches: HEAD`;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
log(` Found ${startPaths.length} antora.yml file(s)`);
|
|
95
|
+
if (startPaths.length === 1) {
|
|
96
|
+
const rel = path.relative(contentDir, path.dirname(startPaths[0]));
|
|
97
|
+
log(` Using start_path: ${rel || '.'}`);
|
|
98
|
+
sourcesYaml = ` - url: ${contentDir}\n branches: HEAD\n start_path: ${rel || '.'}`;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const paths = startPaths
|
|
102
|
+
.map((f) => path.relative(contentDir, path.dirname(f)))
|
|
103
|
+
.filter((p) => p.length > 0);
|
|
104
|
+
const pathsStr = paths.length > 0
|
|
105
|
+
? `\n${paths.map((p) => ` - ${p}`).join('\n')}`
|
|
106
|
+
: '';
|
|
107
|
+
sourcesYaml = ` - url: ${contentDir}\n branches: HEAD\n start_paths:${pathsStr}`;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return `
|
|
111
|
+
site:
|
|
112
|
+
title: Dockit — ${entryId}
|
|
113
|
+
url: /api/bundle/${entryId}
|
|
114
|
+
content:
|
|
115
|
+
sources:
|
|
116
|
+
${sourcesYaml}
|
|
117
|
+
ui:
|
|
118
|
+
bundle:
|
|
119
|
+
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
|
|
120
|
+
snapshot: true
|
|
121
|
+
output:
|
|
122
|
+
dir: ${outputDir}
|
|
123
|
+
`.trim();
|
|
124
|
+
}
|
|
125
|
+
function generatePlaybookFromExisting(playbookPath, outputDir) {
|
|
126
|
+
const raw = fs.readFileSync(playbookPath, 'utf-8');
|
|
127
|
+
if (raw.includes('output:') && raw.includes('dir:')) {
|
|
128
|
+
return raw;
|
|
129
|
+
}
|
|
130
|
+
return raw + `\noutput:\n dir: ${outputDir}\n`;
|
|
131
|
+
}
|
|
132
|
+
async function runAntora(playbookPath, log) {
|
|
133
|
+
log(`Running Antora with playbook ${playbookPath}`);
|
|
134
|
+
return new Promise((resolve, reject) => {
|
|
135
|
+
const proc = spawn('npx', ['antora', playbookPath], {
|
|
136
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
137
|
+
cwd: path.dirname(playbookPath),
|
|
138
|
+
env: { ...process.env, CI: 'true' },
|
|
139
|
+
});
|
|
140
|
+
let stderr = '';
|
|
141
|
+
proc.stdout?.on('data', (data) => {
|
|
142
|
+
const lines = data.toString().trim().split('\n');
|
|
143
|
+
for (const line of lines) {
|
|
144
|
+
if (line)
|
|
145
|
+
log(` antora: ${line}`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
proc.stderr?.on('data', (data) => {
|
|
149
|
+
stderr += data.toString();
|
|
150
|
+
});
|
|
151
|
+
proc.on('close', (code) => {
|
|
152
|
+
if (code === 0) {
|
|
153
|
+
log('Antora build completed successfully');
|
|
154
|
+
resolve();
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
const tail = stderr.slice(-800);
|
|
158
|
+
log(`Antora build failed (stderr: ${tail})`);
|
|
159
|
+
reject(new Error(`Antora build failed with code ${code}`));
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
proc.on('error', reject);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
export async function buildAntoraSource(config, entryId, workDir, log) {
|
|
166
|
+
let contentDir;
|
|
167
|
+
let cleanupDir;
|
|
168
|
+
if (config.localPath) {
|
|
169
|
+
if (!fs.existsSync(config.localPath)) {
|
|
170
|
+
throw new Error(`Local path not found: ${config.localPath}`);
|
|
171
|
+
}
|
|
172
|
+
if (!fs.statSync(config.localPath).isDirectory()) {
|
|
173
|
+
throw new Error(`localPath must be a directory: ${config.localPath}`);
|
|
174
|
+
}
|
|
175
|
+
log(`Using local directory: ${config.localPath}`);
|
|
176
|
+
contentDir = config.localPath;
|
|
177
|
+
}
|
|
178
|
+
else if (config.repoUrl) {
|
|
179
|
+
contentDir = path.join(workDir, 'content');
|
|
180
|
+
await cloneRepo(config.repoUrl, contentDir, log);
|
|
181
|
+
cleanupDir = contentDir;
|
|
182
|
+
}
|
|
183
|
+
else if (config.zipPath) {
|
|
184
|
+
contentDir = path.join(workDir, 'content');
|
|
185
|
+
await extractZip(config.zipPath, contentDir, log);
|
|
186
|
+
cleanupDir = contentDir;
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
throw new Error('Antora source requires repoUrl, localPath, or zipPath');
|
|
190
|
+
}
|
|
191
|
+
const playbookPath = path.join(workDir, 'antora-playbook.yml');
|
|
192
|
+
const outputDir = path.join(workDir, 'output');
|
|
193
|
+
const existingPlaybook = findExistingPlaybook(contentDir);
|
|
194
|
+
if (existingPlaybook) {
|
|
195
|
+
log(`Found existing playbook at ${path.relative(contentDir, existingPlaybook)}`);
|
|
196
|
+
const playbookContent = generatePlaybookFromExisting(existingPlaybook, outputDir);
|
|
197
|
+
fs.writeFileSync(playbookPath, playbookContent, 'utf-8');
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
const antoraFiles = findAntoraYmlFiles(contentDir);
|
|
201
|
+
if (antoraFiles.length === 0) {
|
|
202
|
+
throw new Error(`No antora.yml files found in repository. ` +
|
|
203
|
+
`This repo does not appear to be an Antora-based documentation source. ` +
|
|
204
|
+
`Use a ZIP or Maven source type instead, or provide the URL to the specific ` +
|
|
205
|
+
`Antora documentation repository (e.g. a repo containing antora.yml files).`);
|
|
206
|
+
}
|
|
207
|
+
const playbookContent = generatePlaybook(entryId, contentDir, outputDir, antoraFiles, log);
|
|
208
|
+
fs.writeFileSync(playbookPath, playbookContent, 'utf-8');
|
|
209
|
+
}
|
|
210
|
+
await runAntora(playbookPath, log);
|
|
211
|
+
return outputDir;
|
|
212
|
+
}
|
|
213
|
+
export function ensureAntoraInstalled() {
|
|
214
|
+
try {
|
|
215
|
+
execSync('npx antora --version', { stdio: 'pipe' });
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=antora.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antora.js","sourceRoot":"","sources":["../../src/services/antora.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE,SAAiB,EAAE,GAA0B;IACrF,GAAG,CAAC,sBAAsB,OAAO,EAAE,CAAC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AE,CAAC,aAAa,CAAC,YAAY,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACnD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,2CAA2C;gBAC3C,wEAAwE;gBACxE,6EAA6E;gBAC7E,4EAA4E,CAC7E,CAAC;QACJ,CAAC;QACD,MAAM,eAAe,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;QAC3F,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,SAAS,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAEnC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC;QACH,QAAQ,CAAC,sBAAsB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACpD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { Readable } from 'node:stream';
|
|
6
|
+
import { pipeline } from 'node:stream/promises';
|
|
7
|
+
import unzipper from 'unzipper';
|
|
8
|
+
import asciidoctorModule from '@asciidoctor/core';
|
|
9
|
+
const asciidoctor = asciidoctorModule;
|
|
10
|
+
const SKIP_DIRS = new Set([
|
|
11
|
+
'node_modules', 'target', 'build', 'dist', '.git',
|
|
12
|
+
'integrations', 'extensions', 'independent-projects',
|
|
13
|
+
'test', 'tests', 'tcks',
|
|
14
|
+
]);
|
|
15
|
+
async function cloneRepo(repoUrl, targetDir, log) {
|
|
16
|
+
log(`Cloning repository ${repoUrl}`);
|
|
17
|
+
if (fs.existsSync(targetDir))
|
|
18
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
const proc = spawn('git', ['clone', '--depth', '1', repoUrl, targetDir], {
|
|
21
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
22
|
+
});
|
|
23
|
+
let stderr = '';
|
|
24
|
+
proc.stderr?.on('data', (data) => {
|
|
25
|
+
stderr += data.toString();
|
|
26
|
+
const lines = data.toString().trim().split('\n');
|
|
27
|
+
for (const line of lines) {
|
|
28
|
+
if (line)
|
|
29
|
+
log(` git: ${line}`);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
proc.on('close', (code) => {
|
|
33
|
+
if (code === 0) {
|
|
34
|
+
log('Repository cloned successfully');
|
|
35
|
+
resolve();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
reject(new Error(`git clone failed with code ${code}: ${stderr}`));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
proc.on('error', reject);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
async function extractZip(zipPath, targetDir, log) {
|
|
45
|
+
log(`Extracting local ZIP from ${zipPath}`);
|
|
46
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
47
|
+
const data = fs.readFileSync(zipPath);
|
|
48
|
+
const stream = Readable.from(data);
|
|
49
|
+
await pipeline(stream, unzipper.Extract({ path: targetDir }));
|
|
50
|
+
const entries = fs.readdirSync(targetDir);
|
|
51
|
+
if (entries.length === 1 && fs.statSync(path.join(targetDir, entries[0])).isDirectory()) {
|
|
52
|
+
log('Detected single root directory, flattening...');
|
|
53
|
+
const innerDir = path.join(targetDir, entries[0]);
|
|
54
|
+
const innerEntries = fs.readdirSync(innerDir);
|
|
55
|
+
for (const entry of innerEntries) {
|
|
56
|
+
fs.renameSync(path.join(innerDir, entry), path.join(targetDir, entry));
|
|
57
|
+
}
|
|
58
|
+
fs.rmdirSync(innerDir);
|
|
59
|
+
}
|
|
60
|
+
log(`Extracted ZIP to ${targetDir}`);
|
|
61
|
+
}
|
|
62
|
+
function findAdocFiles(dir, sourcePath) {
|
|
63
|
+
const root = sourcePath ? path.join(dir, sourcePath) : dir;
|
|
64
|
+
if (!fs.existsSync(root)) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const results = [];
|
|
68
|
+
const stack = [root];
|
|
69
|
+
while (stack.length > 0) {
|
|
70
|
+
const current = stack.pop();
|
|
71
|
+
let entries;
|
|
72
|
+
try {
|
|
73
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
if (entry.name.startsWith('.') || SKIP_DIRS.has(entry.name))
|
|
80
|
+
continue;
|
|
81
|
+
const fullPath = path.join(current, entry.name);
|
|
82
|
+
if (entry.isDirectory()) {
|
|
83
|
+
stack.push(fullPath);
|
|
84
|
+
}
|
|
85
|
+
else if (entry.name.endsWith('.adoc')) {
|
|
86
|
+
results.push(fullPath);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return results;
|
|
91
|
+
}
|
|
92
|
+
async function runAsciidoctor(adocFiles, sourceRoot, targetDir, log) {
|
|
93
|
+
log(`Converting ${adocFiles.length} .adoc files to HTML`);
|
|
94
|
+
const adoc = asciidoctor();
|
|
95
|
+
let filesProcessed = 0;
|
|
96
|
+
let filesSkipped = 0;
|
|
97
|
+
for (const adocFile of adocFiles) {
|
|
98
|
+
try {
|
|
99
|
+
const relPath = path.relative(sourceRoot, adocFile);
|
|
100
|
+
const outDir = path.join(targetDir, path.dirname(relPath));
|
|
101
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
102
|
+
adoc.convertFile(adocFile, {
|
|
103
|
+
to_dir: outDir,
|
|
104
|
+
base_dir: path.dirname(adocFile),
|
|
105
|
+
mkdirs: true,
|
|
106
|
+
safe: 'unsafe',
|
|
107
|
+
});
|
|
108
|
+
filesProcessed++;
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
const rel = path.relative(sourceRoot, adocFile);
|
|
112
|
+
log(` WARNING: Failed to convert ${rel}: ${err.message || err}`);
|
|
113
|
+
filesSkipped++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const htmlCount = countHtmlFiles(targetDir);
|
|
117
|
+
log(`AsciiDoc conversion complete: ${filesProcessed} converted, ${filesSkipped} skipped, ${htmlCount} HTML files generated`);
|
|
118
|
+
if (htmlCount === 0 && filesProcessed === 0) {
|
|
119
|
+
throw new Error('Asciidoctor failed to produce any HTML. Check that the source files are valid.');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function countHtmlFiles(dir) {
|
|
123
|
+
if (!fs.existsSync(dir))
|
|
124
|
+
return 0;
|
|
125
|
+
let count = 0;
|
|
126
|
+
const stack = [dir];
|
|
127
|
+
while (stack.length > 0) {
|
|
128
|
+
const current = stack.pop();
|
|
129
|
+
let entries;
|
|
130
|
+
try {
|
|
131
|
+
entries = fs.readdirSync(current, { withFileTypes: true });
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
for (const e of entries) {
|
|
137
|
+
const p = path.join(current, e.name);
|
|
138
|
+
if (e.isDirectory() && !e.name.startsWith('.'))
|
|
139
|
+
stack.push(p);
|
|
140
|
+
else if (e.name.endsWith('.html'))
|
|
141
|
+
count++;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return count;
|
|
145
|
+
}
|
|
146
|
+
function rmDir(dir) {
|
|
147
|
+
try {
|
|
148
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
// best-effort cleanup
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
export async function buildAsciidocSource(config, targetDir, log) {
|
|
155
|
+
let repoDir;
|
|
156
|
+
let shouldCleanup;
|
|
157
|
+
if (config.localPath) {
|
|
158
|
+
if (!fs.existsSync(config.localPath)) {
|
|
159
|
+
throw new Error(`Local path not found: ${config.localPath}`);
|
|
160
|
+
}
|
|
161
|
+
if (!fs.statSync(config.localPath).isDirectory()) {
|
|
162
|
+
throw new Error(`localPath must be a directory: ${config.localPath}`);
|
|
163
|
+
}
|
|
164
|
+
log(`Using local directory: ${config.localPath}`);
|
|
165
|
+
repoDir = config.localPath;
|
|
166
|
+
shouldCleanup = false;
|
|
167
|
+
}
|
|
168
|
+
else if (config.repoUrl) {
|
|
169
|
+
repoDir = path.join(os.tmpdir(), `dockit-asciidoc-${Date.now()}`);
|
|
170
|
+
await cloneRepo(config.repoUrl, repoDir, log);
|
|
171
|
+
shouldCleanup = true;
|
|
172
|
+
}
|
|
173
|
+
else if (config.zipPath) {
|
|
174
|
+
repoDir = path.join(os.tmpdir(), `dockit-asciidoc-${Date.now()}`);
|
|
175
|
+
fs.mkdirSync(repoDir, { recursive: true });
|
|
176
|
+
await extractZip(config.zipPath, repoDir, log);
|
|
177
|
+
shouldCleanup = true;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
throw new Error('AsciiDoc source requires repoUrl, localPath, or zipPath');
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const sourcePath = config.sourcePath || '';
|
|
184
|
+
const sourceRoot = sourcePath ? path.join(repoDir, sourcePath) : repoDir;
|
|
185
|
+
log(`Scanning for .adoc files in ${sourcePath || 'repository root'}`);
|
|
186
|
+
const adocFiles = findAdocFiles(repoDir, sourcePath);
|
|
187
|
+
if (adocFiles.length === 0) {
|
|
188
|
+
if (sourcePath) {
|
|
189
|
+
throw new Error(`No .adoc files found at path "${sourcePath}" in the repository`);
|
|
190
|
+
}
|
|
191
|
+
throw new Error(`No .adoc files found in the repository. ` +
|
|
192
|
+
`If the docs live in a subdirectory, set the "sourcePath" field ` +
|
|
193
|
+
`(e.g. "docs/src/main/asciidoc" for Quarkus).`);
|
|
194
|
+
}
|
|
195
|
+
log(`Found ${adocFiles.length} .adoc file(s)`);
|
|
196
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
197
|
+
await runAsciidoctor(adocFiles, sourceRoot, targetDir, log);
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
if (shouldCleanup && fs.existsSync(repoDir)) {
|
|
201
|
+
log('Cleaning up cloned repository...');
|
|
202
|
+
rmDir(repoDir);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=asciidoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asciidoc.js","sourceRoot":"","sources":["../../src/services/asciidoc.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,iBAAiB,MAAM,mBAAmB,CAAC;AAMlD,MAAM,WAAW,GAAG,iBAA+C,CAAC;AAEpE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IACjD,cAAc,EAAE,YAAY,EAAE,sBAAsB;IACpD,MAAM,EAAE,OAAO,EAAE,MAAM;CACxB,CAAC,CAAC;AAEH,KAAK,UAAU,SAAS,CAAC,OAAe,EAAE,SAAiB,EA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