Skip to content

Commit c7a52cc

Browse files
authored
Remove all app-builder stuff (#502)
1 parent 5e81aeb commit c7a52cc

86 files changed

Lines changed: 259 additions & 7521 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,44 +10,24 @@
1010
</p>
1111

1212
<p align="center">
13-
<a href="https://srcbook.com">Online app builder</a> ·
13+
<a href="https://hub.srcbook.com">Examples</a> ·
1414
<a href="https://discord.gg/shDEGBSe2d">Discord</a> ·
1515
<a href="https://www.youtube.com/@srcbook">Youtube</a> ·
1616
<a href="https://hub.srcbook.com">Hub</a>
1717
</p>
1818

1919
## Maintainers Note
2020

21-
Srcbook is currently not under active development. After overwhelming demand of making it a managed service, we have built and are operating https://getmocha.com for this purpose!
22-
23-
In the future, we might revive Srcbook for its notebook product (over the app builder one, which is better served by Mocha).
21+
Srcbook is not under active development.
2422

2523
## Srcbook
2624

27-
Srcbook is a TypeScript-centric app development platform, with 2 main products:
28-
29-
- an AI app builder (also available [hosted online](https://srcbook.com/))
30-
- a TypeScript notebook
25+
Srcbook is a TypeScript notebook that runs locally on your machine.
3126

3227
Srcbook is open-source (apache2) and runs locally on your machine. You'll need to bring your own API key for AI usage (we strongly recommend Anthropic with `claude-3-5-sonnet-latest`).
3328

3429
## Features
3530

36-
### App Builder
37-
38-
- AI app builder for TypeScript
39-
- Create, edit and run web apps
40-
- Use AI to generate the boilerplate, modify the code, and fix things
41-
- Edit the app with a hot-reloading web preview
42-
43-
<picture>
44-
<source media="(prefers-color-scheme: dark)" srcset="https://i.imgur.com/lLJPZOs.png">
45-
<source media="(prefers-color-scheme: light)" srcset="https://i.imgur.com/k4xAyCQ.png">
46-
<img alt="Example Srcbook" src="https://i.imgur.com/k4xAyCQ.png">
47-
</picture>
48-
49-
### Notebooks
50-
5131
- Create, run, and share TypeScript notebooks
5232
- Export to valid markdown format (.src.md)
5333
- AI features for exploring and iterating on ideas
@@ -120,7 +100,7 @@ Options:
120100

121101
Commands:
122102
start [options] Start the Srcbook server
123-
import [options] <specifier> Import a Notebook
103+
import [options] <specifier> Import a notebook
124104
help [command] display help for command
125105
```
126106

packages/api/ai/app-parser.mts

Lines changed: 0 additions & 103 deletions
This file was deleted.

packages/api/ai/generate.mts

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { streamText, generateText, type GenerateTextResult } from 'ai';
1+
import { generateText, type GenerateTextResult } from 'ai';
22
import { getModel } from './config.mjs';
33
import {
44
type CodeLanguageType,
@@ -12,8 +12,6 @@ import { readFileSync } from 'node:fs';
1212
import Path from 'node:path';
1313
import { PROMPTS_DIR } from '../constants.mjs';
1414
import { encode, decodeCells } from '../srcmd.mjs';
15-
import { buildProjectXml, type FileContent } from '../ai/app-parser.mjs';
16-
import { logAppGeneration } from './logger.mjs';
1715

1816
const makeGenerateSrcbookSystemPrompt = () => {
1917
return readFileSync(Path.join(PROMPTS_DIR, 'srcbook-generator.txt'), 'utf-8');
@@ -26,34 +24,6 @@ const makeGenerateCellSystemPrompt = (language: CodeLanguageType) => {
2624
const makeFixDiagnosticsSystemPrompt = () => {
2725
return readFileSync(Path.join(PROMPTS_DIR, 'fix-cell-diagnostics.txt'), 'utf-8');
2826
};
29-
const makeAppBuilderSystemPrompt = () => {
30-
return readFileSync(Path.join(PROMPTS_DIR, 'app-builder.txt'), 'utf-8');
31-
};
32-
const makeAppEditorSystemPrompt = () => {
33-
return readFileSync(Path.join(PROMPTS_DIR, 'app-editor.txt'), 'utf-8');
34-
};
35-
36-
const makeAppEditorUserPrompt = (projectId: string, files: FileContent[], query: string) => {
37-
const projectXml = buildProjectXml(files, projectId);
38-
const userRequestXml = `<userRequest>${query}</userRequest>`;
39-
return `Following below are the project XML and the user request.
40-
41-
${projectXml}
42-
43-
${userRequestXml}
44-
`.trim();
45-
};
46-
47-
const makeAppCreateUserPrompt = (projectId: string, files: FileContent[], query: string) => {
48-
const projectXml = buildProjectXml(files, projectId);
49-
const userRequestXml = `<userRequest>${query}</userRequest>`;
50-
return `Following below are the project XML and the user request.
51-
52-
${projectXml}
53-
54-
${userRequestXml}
55-
`.trim();
56-
};
5727

5828
const makeGenerateCellUserPrompt = (session: SessionType, insertIdx: number, query: string) => {
5929
// Make sure we copy cells so we don't mutate the session
@@ -242,55 +212,3 @@ export async function fixDiagnostics(
242212

243213
return result.text;
244214
}
245-
246-
export async function generateApp(
247-
projectId: string,
248-
files: FileContent[],
249-
query: string,
250-
): Promise<string> {
251-
const model = await getModel();
252-
const result = await generateText({
253-
model,
254-
system: makeAppBuilderSystemPrompt(),
255-
prompt: makeAppCreateUserPrompt(projectId, files, query),
256-
});
257-
return result.text;
258-
}
259-
260-
export async function streamEditApp(
261-
projectId: string,
262-
files: FileContent[],
263-
query: string,
264-
appId: string,
265-
planId: string,
266-
) {
267-
const model = await getModel();
268-
269-
const systemPrompt = makeAppEditorSystemPrompt();
270-
const userPrompt = makeAppEditorUserPrompt(projectId, files, query);
271-
272-
let response = '';
273-
274-
const result = await streamText({
275-
model,
276-
system: systemPrompt,
277-
prompt: userPrompt,
278-
onChunk: (chunk) => {
279-
if (chunk.chunk.type === 'text-delta') {
280-
response += chunk.chunk.textDelta;
281-
}
282-
},
283-
onFinish: () => {
284-
if (process.env.SRCBOOK_DISABLE_ANALYTICS !== 'true') {
285-
logAppGeneration({
286-
appId,
287-
planId,
288-
llm_request: { model, system: systemPrompt, prompt: userPrompt },
289-
llm_response: response,
290-
});
291-
}
292-
},
293-
});
294-
295-
return result.textStream;
296-
}

packages/api/ai/logger.mts

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)