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

Function deploy

packages/baseai/src/deploy/index.ts:41–114  ·  view source on GitHub ↗
({
	overwrite = false
}: {
	overwrite: boolean;
})

Source from the content-addressed store, hash-verified

39type Spinner = ReturnType<typeof p.spinner>;
40
41async function deploy({
42 overwrite = false
43}: {
44 overwrite: boolean;
45}): Promise<void> {
46 const spinner = p.spinner();
47
48 p.intro(heading({ text: 'DEPLOY', sub: 'Deploy your BaseAI project' }));
49
50 try {
51 // Build Pipes and Memory.
52 await build({ calledAsCommand: false });
53 const buildDir = path.join(process.cwd(), '.baseai');
54
55 const pipesDir = path.join(buildDir, 'pipes');
56 const pipes = await readPipesDirectory({ spinner, pipesDir });
57 if (!pipes) {
58 p.outro(
59 `No pipes found. Skipping deployment of pipes. \nAdd a pipe by running: ${cyan(`npx baseai@latest pipe`)} command`
60 );
61 }
62
63 const memoryDir = path.join(buildDir, 'memory');
64 const memory = await readMemoryDirectory({
65 spinner,
66 memoryDir
67 });
68
69 const toolsDir = path.join(buildDir, 'tools');
70 const tools = await readToolsDirectory({ spinner, toolsDir });
71
72 const account = await retrieveAuthentication({ spinner });
73 if (!account) {
74 p.outro(
75 `No account found. Skipping deployment. \n Run: ${cyan('npx baseai@latest auth')}`
76 );
77 process.exit(1);
78 }
79
80 if (memory && memory.length > 0) {
81 await deployMemories({
82 spinner,
83 memory,
84 memoryDir,
85 account,
86 overwrite
87 });
88 }
89 if (pipes) await deployPipes({ spinner, pipes, pipesDir, account });
90
91 p.outro(
92 heading({ text: 'DEPLOYED', sub: 'successfully', green: true })
93 );
94
95 p.log.warning(
96 dimItalic(
97 `Make sure ${cyan(`LANGBASE_API_KEY`)} exists in your production environment.`
98 )

Callers 1

index.tsFile · 0.90

Calls 9

headingFunction · 0.90
retrieveAuthenticationFunction · 0.90
dimItalicFunction · 0.90
readPipesDirectoryFunction · 0.85
readMemoryDirectoryFunction · 0.85
readToolsDirectoryFunction · 0.85
deployMemoriesFunction · 0.85
deployPipesFunction · 0.85
handleErrorFunction · 0.70

Tested by

no test coverage detected