Skip to content

Commit 2891441

Browse files
authored
Merge pull request #36 from levante-hub/release/v1.0.0
Release v1.0.0
2 parents e608492 + 9e9b484 commit 2891441

File tree

86 files changed

+14364
-1215
lines changed

Some content is hidden

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

86 files changed

+14364
-1215
lines changed

.github/workflows/beta-release.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Beta Release Build & Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*-beta.*' # Only beta tags
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build & Release Beta - ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- os: macos-latest
21+
platform: darwin
22+
arch: arm64
23+
- os: windows-latest
24+
platform: win32
25+
arch: x64
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: '22.20.0'
35+
36+
- name: Setup Python 3.11
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.11'
40+
41+
- name: Setup pnpm
42+
uses: pnpm/action-setup@v2
43+
with:
44+
version: 9.4.0
45+
46+
- name: Get pnpm store directory
47+
shell: bash
48+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
49+
50+
- name: Setup pnpm cache
51+
uses: actions/cache@v4
52+
with:
53+
path: ${{ env.STORE_PATH }}
54+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
55+
restore-keys: |
56+
${{ runner.os }}-pnpm-store-
57+
58+
- name: Install dependencies
59+
run: pnpm install --frozen-lockfile
60+
61+
# macOS signing (required for signed builds)
62+
- name: Import Apple certificate (macOS)
63+
if: matrix.platform == 'darwin'
64+
env:
65+
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
66+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
67+
run: |
68+
security create-keychain -p actions temp.keychain
69+
security default-keychain -s temp.keychain
70+
security unlock-keychain -p actions temp.keychain
71+
security set-keychain-settings -t 3600 -u temp.keychain
72+
73+
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > certificate.p12
74+
security import certificate.p12 -k temp.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
75+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k actions temp.keychain
76+
77+
rm certificate.p12
78+
79+
- name: Build and package application
80+
env:
81+
# Only set signing env vars if secrets exist, otherwise build unsigned
82+
APPLE_ID: ${{ secrets.APPLE_ID }}
83+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
84+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
85+
run: pnpm run make
86+
87+
- name: Package & Publish Beta (macOS)
88+
if: matrix.platform == 'darwin'
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
91+
# Notarization env vars needed for electron-forge publish
92+
APPLE_ID: ${{ secrets.APPLE_ID }}
93+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
94+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
95+
run: pnpm run publish
96+
97+
- name: Package & Publish Beta (Windows)
98+
if: matrix.platform == 'win32'
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
101+
run: pnpm run publish
102+
103+
- name: Cleanup keychain (macOS)
104+
if: matrix.platform == 'darwin' && always()
105+
run: security delete-keychain temp.keychain || true
106+
107+
# Mark as pre-release
108+
- name: Mark as pre-release
109+
if: success()
110+
uses: actions/github-script@v7
111+
with:
112+
github-token: ${{ secrets.GH_TOKEN }}
113+
script: |
114+
const tag = context.ref.replace('refs/tags/', '');
115+
const releases = await github.rest.repos.listReleases({
116+
owner: context.repo.owner,
117+
repo: context.repo.repo
118+
});
119+
120+
const release = releases.data.find(r => r.tag_name === tag);
121+
if (release) {
122+
await github.rest.repos.updateRelease({
123+
owner: context.repo.owner,
124+
repo: context.repo.repo,
125+
release_id: release.id,
126+
prerelease: true
127+
});
128+
console.log(`Marked release ${tag} as pre-release`);
129+
}

.github/workflows/release.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Release Build & Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
- '!v*-beta.*' # Exclude beta tags
8+
9+
permissions:
10+
contents: write # Required to create releases
11+
12+
jobs:
13+
build:
14+
name: Build & Release - ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- os: macos-latest
22+
platform: darwin
23+
arch: arm64
24+
- os: windows-latest
25+
platform: win32
26+
arch: x64
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '22.20.0'
36+
37+
- name: Setup Python 3.11
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: '3.11'
41+
42+
- name: Setup pnpm
43+
uses: pnpm/action-setup@v2
44+
with:
45+
version: 9.4.0
46+
47+
- name: Get pnpm store directory
48+
shell: bash
49+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
50+
51+
- name: Setup pnpm cache
52+
uses: actions/cache@v4
53+
with:
54+
path: ${{ env.STORE_PATH }}
55+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
56+
restore-keys: |
57+
${{ runner.os }}-pnpm-store-
58+
59+
- name: Install dependencies
60+
run: pnpm install --frozen-lockfile
61+
62+
# macOS specific: Import signing certificate
63+
- name: Import Apple certificate (macOS)
64+
if: matrix.platform == 'darwin'
65+
env:
66+
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
67+
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
68+
run: |
69+
# Create keychain
70+
security create-keychain -p actions temp.keychain
71+
security default-keychain -s temp.keychain
72+
security unlock-keychain -p actions temp.keychain
73+
security set-keychain-settings -t 3600 -u temp.keychain
74+
75+
# Import certificate
76+
echo "$APPLE_CERTIFICATE_BASE64" | base64 --decode > certificate.p12
77+
security import certificate.p12 -k temp.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
78+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k actions temp.keychain
79+
80+
# Cleanup
81+
rm certificate.p12
82+
83+
- name: Build and package application
84+
env:
85+
# Notarization env vars for osxNotarize in forge.config.js
86+
APPLE_ID: ${{ secrets.APPLE_ID }}
87+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
88+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
89+
run: pnpm run make
90+
91+
- name: Package & Publish (macOS)
92+
if: matrix.platform == 'darwin'
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
95+
APPLE_ID: ${{ secrets.APPLE_ID }}
96+
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
97+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
98+
run: pnpm run publish
99+
100+
- name: Package & Publish (Windows)
101+
if: matrix.platform == 'win32'
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
104+
run: pnpm run publish
105+
106+
# Cleanup macOS keychain
107+
- name: Cleanup keychain (macOS)
108+
if: matrix.platform == 'darwin' && always()
109+
run: |
110+
security delete-keychain temp.keychain || true

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,7 @@ tsconfig.preload.tsbuildinfo
3434
.env.local
3535
.env.development.local
3636
.env.test.local
37-
.env.production.local
37+
.env.production.local
38+
39+
# Vite
40+
.vite

.npmrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Verificar compatibilidad de engines durante la instalación
2+
engine-strict=true
3+
4+
# Usar la versión de Node especificada en package.json
5+
use-node-version=22.20.0
6+
7+
# Requerido por Electron Forge para funcionar correctamente con pnpm
8+
node-linker=hoisted

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

CLAUDE.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ModelStore (Zustand) → ModelService → ModelFetchService → IPC → Main Pro
5656

5757
## Database Schema
5858

59-
SQLite database with migrations in `docs/DB/MIGRATIONS/`:
59+
SQLite database with migrations in `database/migrations/`:
6060
- `chat_sessions`: Session management with model tracking
6161
- `messages`: Message storage with streaming support
6262
- Schema version tracking for migrations
@@ -77,6 +77,11 @@ All IPC uses the `levante/*` namespace with structured responses:
7777
**Preferences:**
7878
- `levante/preferences/get|set|getAll` → Settings management
7979

80+
**Logging:**
81+
- `levante/logger/log` → Send log messages from renderer to main
82+
- `levante/logger/isEnabled` → Check if category/level is enabled
83+
- `levante/logger/configure` → Update logger configuration
84+
8085
## State Management with Zustand
8186

8287
**ChatStore** (`src/renderer/stores/chatStore.ts`):
@@ -152,11 +157,21 @@ Environment variables loaded from:
152157
1. `.env.local` (highest priority, git-ignored)
153158
2. `.env` (committed defaults)
154159

155-
Common variables:
160+
**API Keys:**
156161
- `OPENAI_API_KEY`
157162
- `ANTHROPIC_API_KEY`
158163
- `GOOGLE_GENERATIVE_AI_API_KEY`
159164

165+
**Logging Configuration:**
166+
- `DEBUG_ENABLED` → Master switch for all debug logging
167+
- `DEBUG_AI_SDK` → AI service operations and streaming
168+
- `DEBUG_MCP` → MCP server management and tools
169+
- `DEBUG_DATABASE` → Database operations and migrations
170+
- `DEBUG_IPC` → Inter-process communication
171+
- `DEBUG_PREFERENCES` → Settings and configuration
172+
- `DEBUG_CORE` → Application lifecycle and errors
173+
- `LOG_LEVEL` → Minimum log level (debug|info|warn|error)
174+
160175
## Testing Strategy
161176

162177
- **Unit/Integration**: Vitest for services and utilities
@@ -168,4 +183,53 @@ Common variables:
168183
- **Bundler**: electron-vite with Vite for renderer, esbuild for main/preload
169184
- **TypeScript**: Strict mode with separate configs for main and preload processes
170185
- **Assets**: Icons and resources in `resources/` directory
171-
- **Output**: Built files in `out/` directory for development, `dist-electron/` for distribution
186+
- **Output**: Built files in `out/` directory for development, `dist-electron/` for distribution
187+
- no realices comprobaciones con pnpm dev, se realizaran manualmente
188+
189+
## Logging System
190+
191+
Levante uses a centralized logging system for better development experience and debugging:
192+
193+
### Usage
194+
195+
```typescript
196+
// Main Process
197+
import { getLogger } from './services/logging';
198+
const logger = getLogger();
199+
200+
// Renderer Process
201+
import { logger } from '@/services/logger';
202+
203+
// Usage examples
204+
logger.aiSdk.debug('Model provider loaded', { provider: 'openai' });
205+
logger.mcp.info('Server started', { serverId: 'filesystem' });
206+
logger.database.error('Migration failed', { error: error.message });
207+
logger.core.info('Application initialized');
208+
```
209+
210+
### Categories
211+
212+
- **ai-sdk**: AI service operations, model interactions, streaming
213+
- **mcp**: MCP server management, tool execution, health monitoring
214+
- **database**: Database operations and migrations
215+
- **ipc**: Inter-process communication
216+
- **preferences**: Settings and configuration management
217+
- **core**: General application lifecycle and errors
218+
219+
### Configuration
220+
221+
Control logging via `.env.local`:
222+
223+
```bash
224+
DEBUG_ENABLED=true
225+
DEBUG_AI_SDK=true
226+
DEBUG_MCP=true
227+
DEBUG_DATABASE=false
228+
DEBUG_IPC=false
229+
DEBUG_PREFERENCES=false
230+
DEBUG_CORE=true
231+
LOG_LEVEL=debug
232+
```
233+
234+
See [docs/LOGGING.md](docs/LOGGING.md) for complete documentation.
235+
- No utilices pnpm dev

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,17 @@ We welcome contributions from the community! Here's how to get started:
108108

109109
### Development Workflow
110110
1. Fork the repository
111-
2. Create a feature branch (`git checkout -b feat/your-feature`)
111+
2. Create a feature branch from `develop` (`git checkout develop && git checkout -b feat/your-feature`)
112112
3. Commit your changes (`git commit -m 'feat: add new feature'`)
113113
4. Push to the branch (`git push origin feat/your-feature`)
114-
5. Open a Pull Request
114+
5. Open a Pull Request targeting the `develop` branch
115+
6. Ensure you have at least 1 approval before merging
116+
117+
### Branch Strategy
118+
- **`main`**: Production-ready releases only
119+
- **`develop`**: Default branch for development and integration
120+
- **Feature branches**: Created from `develop`, merged back via PR
121+
- **Branch protection**: Both `main` and `develop` require PR approval and prohibit direct pushes
115122

116123
### Code Guidelines
117124
- Follow existing code style and patterns
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8+
<true/>
9+
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
10+
<true/>
11+
</dict>
12+
</plist>

0 commit comments

Comments
 (0)