forked from stackblitz-labs/bolt.diy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6927c07
Showing
64 changed files
with
12,330 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.20.3] | ||
steps: | ||
- name: Setup | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: 9.4.0 | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run type check | ||
run: pnpm run typecheck | ||
|
||
- name: Run ESLint | ||
run: pnpm run lint | ||
|
||
- name: Run tests | ||
run: pnpm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Semantic Pull Request | ||
on: | ||
pull_request_target: | ||
types: [opened, reopened, edited, synchronize] | ||
permissions: | ||
pull-requests: read | ||
jobs: | ||
main: | ||
name: Validate PR Title | ||
runs-on: ubuntu-latest | ||
steps: | ||
# https://github.com/amannn/action-semantic-pull-request/releases/tag/v5.5.3 | ||
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
subjectPattern: ^(?![A-Z]).+$ | ||
subjectPatternError: | | ||
The subject "{subject}" found in the pull request title "{title}" | ||
didn't match the configured pattern. Please ensure that the subject | ||
doesn't start with an uppercase character. | ||
types: | | ||
fix | ||
feat | ||
chore | ||
build | ||
ci | ||
perf | ||
docs | ||
refactor | ||
revert | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
.vscode/* | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pnpm-lock.yaml | ||
.astro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true, | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"bracketSpacing": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nodejs 18.20.3 | ||
pnpm 9.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Debug Current Test File", | ||
"autoAttachChildProcesses": true, | ||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"], | ||
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs", | ||
"args": ["run", "${relativeFile}"], | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Bolt Monorepo | ||
|
||
Welcome to the Bolt monorepo! This repository contains the codebase for Bolt, an AI assistant developed by StackBlitz. | ||
|
||
## Repository Structure | ||
|
||
Currently, this monorepo contains a single package: | ||
|
||
- [`bolt`](packages/bolt): The main package containing the UI interface for Bolt as well as the server components. | ||
|
||
As the project grows, additional packages may be added to this workspace. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- Node.js (v18.20.3) | ||
- pnpm (v9.4.0) | ||
|
||
### Installation | ||
|
||
1. Clone the repository: | ||
|
||
```bash | ||
git clone https://github.com/stackblitz/bolt.git | ||
cd bolt | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
```bash | ||
pnpm i | ||
``` | ||
|
||
### Development | ||
|
||
To start developing the Bolt UI: | ||
|
||
1. Navigate to the bolt package: | ||
|
||
```bash | ||
cd packages/bolt | ||
``` | ||
|
||
2. Start the development server: | ||
|
||
```bash | ||
pnpm run dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import blitzPlugin from '@blitz/eslint-plugin'; | ||
import { getNamingConventionRule } from '@blitz/eslint-plugin/dist/configs/typescript.js'; | ||
|
||
export default [ | ||
{ | ||
ignores: ['**/dist', '**/node_modules'], | ||
}, | ||
...blitzPlugin.configs.recommended(), | ||
{ | ||
rules: { | ||
'@blitz/catch-error-name': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.tsx'], | ||
rules: { | ||
...getNamingConventionRule({}, true), | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.d.ts'], | ||
rules: { | ||
'@typescript-eslint/no-empty-object-type': 'off', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"private": true, | ||
"license": "MIT", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"playground:dev": "pnpm run --filter=playground dev", | ||
"lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .", | ||
"test": "pnpm run -r test", | ||
"typecheck": "pnpm run -r typecheck", | ||
"prepare": "husky" | ||
}, | ||
"lint-staged": {}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint --edit $1" | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=18.18.0", | ||
"pnpm": "9.4.0" | ||
}, | ||
"devDependencies": { | ||
"@blitz/eslint-plugin": "0.1.0", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"commitlint": "^19.3.0", | ||
"husky": "^9.0.11", | ||
"is-ci": "^3.0.1", | ||
"prettier": "^3.3.2", | ||
"vitest": "^2.0.1" | ||
}, | ||
"resolutions": { | ||
"@typescript-eslint/utils": "^8.0.0-alpha.30" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
node_modules | ||
|
||
/.cache | ||
/build | ||
.env | ||
*.vars | ||
.wrangler | ||
_worker.bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Bolt | ||
|
||
Bolt is an AI assistant developed by StackBlitz. This package contains the UI interface for Bolt as well as the server components, built using [Remix Run](https://remix.run/). | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have the following installed: | ||
|
||
- Node.js (v18.20.3) | ||
- pnpm (v9.4.0) | ||
|
||
## Setup | ||
|
||
1. Clone the repository (if you haven't already): | ||
|
||
```bash | ||
git clone https://github.com/stackblitz/bolt.git | ||
cd bolt | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
```bash | ||
pnpm install | ||
``` | ||
|
||
3. Create a `.env.local` file in the root of the bolt package directory and add your Anthropic API key: | ||
|
||
``` | ||
ANTHROPIC_API_KEY=XXX | ||
``` | ||
|
||
Optionally, you an set the debug level: | ||
|
||
``` | ||
VITE_LOG_LEVEL=debug | ||
``` | ||
|
||
**Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore. | ||
|
||
## Available Scripts | ||
|
||
- `pnpm run dev`: Starts the development server. | ||
- `pnpm run build`: Builds the project. | ||
- `pnpm run start`: Runs the built application locally using Wrangler Pages. This script uses `bindings.sh` to set up necessary bindings so you don't have to duplicate environment variables. | ||
- `pnpm run preview`: Builds the project and then starts it locally, useful for testing the production build. Note, HTTP streaming currently doesn't work as expected with `wrangler pages dev`. | ||
- `pnpm test:` Runs the test suite using Vitest. | ||
- `pnpm run typecheck`: Runs TypeScript type checking. | ||
- `pnpm run typegen`: Generates TypeScript types using Wrangler. | ||
- `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages. | ||
|
||
## Development | ||
|
||
To start the development server: | ||
|
||
```bash | ||
pnpm run dev | ||
``` | ||
|
||
This will start the Remix Vite development server. | ||
|
||
## Testing | ||
|
||
Run the test suite with: | ||
|
||
```bash | ||
pnpm test | ||
``` | ||
|
||
## Deployment | ||
|
||
To deploy the application to Cloudflare Pages: | ||
|
||
```bash | ||
pnpm run deploy | ||
``` | ||
|
||
Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { IconButton } from './ui/IconButton'; | ||
|
||
export function Header() { | ||
return ( | ||
<header className="flex items-center bg-white p-4 border-b border-gray-200"> | ||
<div className="flex items-center gap-2"> | ||
<div className="text-2xl font-semibold text-accent">Bolt</div> | ||
</div> | ||
<IconButton icon="i-ph:gear-duotone" className="ml-auto" /> | ||
</header> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useStore } from '@nanostores/react'; | ||
import { workspaceStore } from '~/lib/stores/workspace'; | ||
|
||
interface ArtifactProps { | ||
messageId: string; | ||
onClick?: () => void; | ||
} | ||
|
||
export function Artifact({ messageId, onClick }: ArtifactProps) { | ||
const artifacts = useStore(workspaceStore.artifacts); | ||
|
||
const artifact = artifacts[messageId]; | ||
|
||
return ( | ||
<button className="flex border rounded-lg overflow-hidden items-stretch bg-gray-50/25 w-full" onClick={onClick}> | ||
<div className="border-r flex items-center px-6 bg-gray-50"> | ||
{!artifact?.closed ? ( | ||
<div className="i-svg-spinners:90-ring-with-bg scale-130"></div> | ||
) : ( | ||
<div className="i-ph:code-bold scale-130 text-gray-600"></div> | ||
)} | ||
</div> | ||
<div className="flex flex-col items-center px-4 p-2.5"> | ||
<div className="text-left w-full">{artifact?.title}</div> | ||
<small className="w-full text-left">Click to open code</small> | ||
</div> | ||
</button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { memo } from 'react'; | ||
import { Markdown } from './Markdown'; | ||
|
||
interface AssistantMessageProps { | ||
content: string; | ||
} | ||
|
||
export const AssistantMessage = memo(({ content }: AssistantMessageProps) => { | ||
return ( | ||
<div className="overflow-hidden w-full"> | ||
<Markdown>{content}</Markdown> | ||
</div> | ||
); | ||
}); |
Oops, something went wrong.