Skip to content

Commit

Permalink
feat: improve readme, disable auto-release
Browse files Browse the repository at this point in the history
- temorary disable auto-release in release gh action
- describe currently not working buliding in docker
- improve building and running instructions in readme
- bump verison
- improve bulid script and dockerfile
  • Loading branch information
erik-balfe committed Oct 14, 2024
1 parent ca53e86 commit 9295005
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- "v*.*.*"
branches:
- "temp-disabled" # building is suspended because it currently produces output with errors in runtime

jobs:
build:
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM oven/bun:1.1.30
WORKDIR /app

# Copy package management files
COPY package.json bun.lockb* ./
COPY package.json ./
COPY bun.lockb ./

# Install dependencies
RUN bun install --frozen-lockfile
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ The agent will interpret your request, execute the necessary commands, and provi
#### Building on local machine

To compile the AI Console Agent into a standalone executable with source maps, follow these steps:
This project requires Bun version 1.1.30. Compilation with lower versions may have some problems.

1. Ensure all project dependencies are installed:
1. Ensure Bun is installed. If not, install it using:

```
bun install
curl -fsSL https://bun.sh/install | bash
```

2. Run the build script:
Expand All @@ -162,10 +161,12 @@ This project requires Bun version 1.1.30. Compilation with lower versions may ha
Build completed successfully. Executable: /path/to/ai-console-agent/dist/ai-console-agent
```

4. The compiled executable will be created in the `dist` directory as `ai-console-agent`, along with source map files.
The compiled executable will be created in the `dist` directory as `ai-console-agent`.

#### Building in Docker

> **Note**: Building in Docker is currently not working and is a work in progress. The following steps are provided for reference but may not function as expected. We are actively working on resolving this issue.
1. Build the Docker image:

```
Expand Down Expand Up @@ -200,10 +201,14 @@ After successful compilation, run the AI Console Agent using:
./dist/ai-console-agent "Your command here"
```

Remember to use the double quotes around your command to avoid issues with special characters in you message.

This executable includes all necessary dependencies and can be distributed as a standalone program.

### Release Process for Developers

> **Note**: The automatic release process for this app via GitHub Actions is currently suspended due to critical errors in the build process of Bun. The executable produced by the GitHub Actions workflow contains a critical error that prevents the application from functioning correctly. As a result, only manual building is working at the moment. The release process described below is temporarily on hold until these issues are resolved.
To create a new release:

1. Ensure all changes are committed and pushed to the main branch.
Expand Down Expand Up @@ -237,7 +242,7 @@ Read about it here: https://bun.sh/docs/bundler/executables

If you encounter errors related to missing packages during compilation, follow these steps:

1. Identify the missing packages from the error messages. Common missing packages might include:
1. Identify the missing packages from the error messages. For example these were such problem packages (currently already included in dev deps, so theyre not a problem anymore):

- pg
- @xenova/transformers
Expand All @@ -255,7 +260,7 @@ If you encounter errors related to missing packages during compilation, follow t
bun add -d pg @xenova/transformers pgvector
```

3. Update your `package.json` to include these as dev dependencies:
3. Look that your `package.json` is updated to include these as dev dependencies:

```json
{
Expand All @@ -280,7 +285,10 @@ If you encounter errors related to missing packages during compilation, follow t

Note: This issue may occur if there are changes in the `llamaindex` package or its dependencies. Always check for updates and be prepared to add new dev dependencies as needed.

### Development Run
Currently adding such packages as dev deps resolves the issue with building project in a single executable.
The problem happens because of dynamic imports in deps of current project, so only adding them as dev deps helps.

### Development run

For development and testing purposes, you can run the project directly without compilation:

Expand Down Expand Up @@ -334,4 +342,4 @@ If you encounter any problems or have any questions, please open an issue on the

## Version

Current version: 0.2.1
Current version: 0.2.3
18 changes: 12 additions & 6 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ const OUTPUT_FILE = path.join(DIST_DIR, "ai-console-agent");
const TEMP_OUTPUT_FILE = path.join(PROJECT_ROOT, "temp-ai-console-agent");

async function build() {
checkBunVersion();

console.log("Starting build process...");
console.log("Build environment:");
console.log(`Bun version: ${process.versions.bun}`);
console.log(`Current working directory: ${process.cwd()}`);
console.log(`PROJECT_ROOT: ${PROJECT_ROOT}`);
console.log(`DIST_DIR: ${DIST_DIR}`);
console.log(`MAIN_FILE: ${MAIN_FILE}`);
console.log(`OUTPUT_FILE: ${OUTPUT_FILE}`);
console.log(`TEMP_OUTPUT_FILE: ${TEMP_OUTPUT_FILE}`);

// Ensure dist directory exists or create it
checkBunVersion();
ensureDirectoryExists(DIST_DIR);

console.log("Installing dependencies...");
Expand All @@ -36,14 +39,17 @@ async function build() {
"--compile",
"--minify",
"--sourcemap",
"--outfile",
TEMP_OUTPUT_FILE,
"--target",
"bun",
"--format",
"esm",
"--outfile",
TEMP_OUTPUT_FILE,
],
{ stdio: "inherit" },
{
stdio: "inherit",
env: { ...process.env, NODE_ENV: "production" },
},
);

if (result.status !== 0) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ai-console-agent",
"version": "0.2.1",
"version": "0.2.3",
"engines": {
"bun": "1.1.30"
},
Expand All @@ -22,7 +22,7 @@
"llamaindex": "^0.6.18",
"@xenova/transformers": "^2.17.2",
"pg": "^8.13.0",
"pgvector": "^0.2.0",
"pgvector": "^0.2.0"
},
"trustedDependencies": [
"protobufjs"
Expand Down

0 comments on commit 9295005

Please sign in to comment.