MCPcopy Index your code
hub / github.com/CommandCodeAI/BaseAI / deploySingleDocument

Function deploySingleDocument

packages/baseai/src/deploy/document.ts:26–78  ·  view source on GitHub ↗
({
	memoryName,
	documentName,
	overwrite
}: {
	memoryName: string;
	documentName: string;
	overwrite: boolean;
})

Source from the content-addressed store, hash-verified

24type Spinner = ReturnType<typeof p.spinner>;
25
26export async function deploySingleDocument({
27 memoryName,
28 documentName,
29 overwrite
30}: {
31 memoryName: string;
32 documentName: string;
33 overwrite: boolean;
34}) {
35 p.intro(heading({ text: 'DEPLOY', sub: 'Deploy a document' }));
36
37 const spinner = p.spinner();
38 try {
39 const { validDocumentName, validMemoryName } = await isMemoryDocExist({
40 spinner,
41 memoryName,
42 documentName
43 });
44
45 spinner.stop('Loaded docs');
46
47 await buildMemory({ memoryName: validMemoryName });
48 const buildDir = path.join(process.cwd(), '.baseai');
49 const memoryDir = path.join(buildDir, 'memory');
50
51 const account = await retrieveAuthentication({ spinner });
52 if (!account) {
53 p.outro(
54 `No account found. Skipping deployment. \n Run: ${cyan('npx baseai@latest auth')}`
55 );
56 process.exit(1);
57 }
58
59 await deployDocument({
60 account,
61 spinner,
62 memoryDir,
63 overwrite,
64 memoryName: validMemoryName,
65 documentName: validDocumentName
66 });
67
68 p.outro(
69 heading({ text: 'DEPLOYED', sub: 'successfully', green: true })
70 );
71 } catch (error) {
72 handleError({
73 spinner,
74 message: 'An unexpected error occurred',
75 error
76 });
77 }
78}
79
80async function deployDocument({
81 account,

Callers 1

index.tsFile · 0.90

Calls 6

headingFunction · 0.90
isMemoryDocExistFunction · 0.90
retrieveAuthenticationFunction · 0.90
buildMemoryFunction · 0.85
deployDocumentFunction · 0.85
handleErrorFunction · 0.70

Tested by

no test coverage detected