Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
ai-sdk:
patterns:
- "ai"
- "@ai-sdk/*"
dev-tooling:
dependency-type: development
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
push:
branches: [main]
pull_request:

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BUN_VERSION: 1.3.12

jobs:
test:
name: verify (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- run: bun install --frozen-lockfile
- name: Typecheck, lint, tests
run: bun run verify
- name: Dead code and unused dependencies
run: bun run knip
- name: Coverage (thresholds from bunfig.toml)
run: bun test --coverage

tui-smoke:
name: TUI smoke + e2e (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install expect (linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y expect
- run: bun install --frozen-lockfile
- name: Sanity — entrypoint runs headless in this job context
run: ANTHROPIC_API_KEY=fake bun run packages/cli/src/index.tsx --help | grep -q "Usage: minerva"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
- name: PTY render smoke
run: bun run smoke:tui
- name: PTY scripted conversation e2e
run: bun run e2e:tui

release-smoke:
name: compiled binary (ubuntu)
# macOS excluded on purpose: Bun 1.3.12 emits unsigned arm64 binaries the
# kernel SIGKILLs — tracked in docs/DESIGN.md watchlist.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- run: bun install --frozen-lockfile
- run: bun run build:release
- name: Binary answers --help
run: |
out="$(ANTHROPIC_API_KEY=fake ./dist/minerva --help)"
echo "$out"
echo "$out" | grep -q "Usage: minerva"

live-smoke:
name: live model smoke (main only, needs secret)
# Never runs on PRs: no secret exposure to fork-able contexts, no token
# spend per pull request. Skips quietly when the secret is not configured.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- run: bun install --frozen-lockfile
- name: One real prompt against the default provider
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: bun run scripts/live-smoke.ts
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Changelog

All notable changes to Minerva are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
[SemVer](https://semver.org/) once tagged.

## [Unreleased]

### Added
- CI (GitHub Actions): verify matrix on ubuntu/macos, per-file coverage
thresholds, knip, PTY smoke + e2e for the TUI, compiled-binary smoke, and a
secret-gated live-model smoke on main pushes; Dependabot.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
- Ink UI test suite (ink-testing-library) and PTY e2e scripts in `scripts/`.
- `CONTRIBUTING.md`, `docs/PROTOCOL.md`, this changelog.

### Changed
- Stricter static analysis: `exactOptionalPropertyTypes`, `noImplicitOverride`,
Biome `noExplicitAny` at error level, knip in the gate.
- `PermissionBridge` is a factory function instead of a class.

## [0.1.0] — 2026-07-10

Initial version: the headless kernel + CLI milestone (PR #1).

### Added
- **Protocol** (`@minerva/protocol`): bidirectional JSON-RPC 2.0 with
ACP-shaped methods, in-process and stdio (newline-delimited) transports,
`minerva/*` extension namespace. See `docs/PROTOCOL.md`.
- **Kernel** (`@minerva/kernel`): streaming agent loop; append-only JSONL
event-sourced sessions with resume (`session/load` replay, kill-9 safe) and
audit trail; permission rule engine (`bash(git *)` patterns) with session
modes (`plan`/`default`/`acceptEdits`/`auto`) and always-allow persistence;
built-in tools (read/write/edit files, glob, grep, bash, todo) with
workspace confinement; MCP client (stdio servers from settings, tools
permission-gated as `mcp__server__tool`); manual `/compact`.
- **Providers** (`@minerva/providers`): kernel-owned `ModelProvider` boundary
over the Vercel AI SDK; Anthropic (default `claude-opus-4-8`) and OpenAI via
`provider/model` references.
- **Client** (`@minerva/client`): frontend-agnostic protocol client + session
view-model store shared by the CLI and the planned GUI.
- **CLI** (`@minerva/cli`): Ink terminal UI with streaming, permission
prompts, todo checklist, `--continue`/`--resume`, `/mode`, `/compact`,
`/sessions`, `/new`; `minerva acp` stdio host for editors.

### Known issues
- Bun 1.3.12 on macOS arm64 emits unsigned compiled binaries (SIGKILLed on
launch); run via `bun` until resolved.
- Live Zed interop over `minerva acp` not yet validated (wire contract is
harness-tested).
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Contributing to Minerva

## Setup

```sh
bun install # Bun ≥ 1.3 (CI pins 1.3.12)
bun run verify # typecheck + lint + all tests — the gate for everything
```

The repo is a Bun workspace; packages export TypeScript source directly (no
build step). `tsc --noEmit` typechecks, Biome lints/formats, `bun test` runs
everything, and knip guards against dead exports and unused dependencies.

## The verify gate

`bun run verify` must be green before anything lands on `main`. CI enforces it
on every PR (ubuntu + macos), plus:

- `bun test --coverage` — per-file thresholds from `bunfig.toml` (bun applies
them per file, not to the total). Ratchet up, never down.
- `bun run knip` — dead code / unused deps.
- `bun run smoke:tui` and `bun run e2e:tui` — the Ink UI under a real PTY
(requires `expect`; preinstalled on macOS, `apt install expect` on Linux).

## Workflow

- **Branch for substantial work** (`<type>/<topic>`, e.g. `feat/mcp-http`,
`chore/quality-gates`); trivial fixes may land on `main` directly with a
green gate.
- **One commit per logical slice**, Conventional Commits. The subject says
what changed; the body explains *why* — the problem, the decision, the
trade-off. `git log` should make sense without opening PRs.
- **PRs merge without squashing** (merge commit) so the curated history
survives on `main`.

## Test layout

| Location | What it covers |
|---|---|
| `packages/*/test/*.test.ts` | Unit + integration per package |
| `packages/client/test/` | Full-stack flows over the in-proc transport (resume, compact, permissions) |
| `packages/cli/test/acp.test.ts` | Real child process over stdio (ACP wire contract) |
| `packages/cli/test/app.test.tsx` | Ink UI via ink-testing-library, real kernel underneath |
| `packages/kernel/test/mcp.test.ts` | Real spawned MCP server from project settings |
| `scripts/*.exp` | The TUI under a genuine pseudo-terminal |

Tests never touch `~/.minerva`: they pass a temp `dataDir` to the kernel (or
set `MINERVA_DATA_DIR` for spawned processes). Do the same for manual testing:

```sh
MINERVA_DATA_DIR=$(mktemp -d) bun run --cwd packages/cli dev
```

## Running things

```sh
bun run --cwd packages/cli dev # interactive TUI (needs ANTHROPIC_API_KEY)
bun run packages/cli/src/index.tsx acp # kernel on stdio for editors
bun run build:release # single-file executable (see README caveat)
```

## Design context

Read [docs/DESIGN.md](docs/DESIGN.md) (architecture decisions and their
rationale) and [docs/PROTOCOL.md](docs/PROTOCOL.md) (the wire protocol) before
changing kernel or protocol behavior. The protocol version is pinned; breaking
wire changes need a version bump and a documented migration.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Minerva

[![CI](https://github.com/hutusi/minerva/actions/workflows/ci.yml/badge.svg)](https://github.com/hutusi/minerva/actions/workflows/ci.yml)

A cross-platform, model-agnostic code agent — a headless kernel with multiple
frontends (CLI now, GUI later).

Expand All @@ -8,7 +10,8 @@ frontends (CLI now, GUI later).
stdio; WebSocket planned).
- **Stack**: TypeScript, Bun, Vercel AI SDK, Ink (CLI), Tauri 2 (GUI, planned).

See [docs/DESIGN.md](docs/DESIGN.md) for the design record and current status.
Docs: [design record](docs/DESIGN.md) · [wire protocol](docs/PROTOCOL.md) ·
[contributing](CONTRIBUTING.md) · [changelog](CHANGELOG.md)

## Quick start

Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"rules": {
"preset": "recommended",
"suspicious": {
"noExplicitAny": "warn"
"noExplicitAny": "error"
}
}
},
Expand Down
Loading