Skip to content

Commit 7614c2e

Browse files
committed
docs: update CLI invocations for unified @cortexkit/magic-context + add Discord
The CLI restructure (94d676a) moved setup/doctor/migrate from per-plugin binaries (`bunx ... opencode-magic-context setup`, `magic-context-pi`) into the unified @cortexkit/magic-context CLI with --harness flag. Documentation still pointed users at the now-removed binaries — every `bunx --bun @cortexkit/{opencode,pi}-magic-context@latest setup|doctor` in the docs would fail because those packages no longer ship a bin entry. Updated: - README.md - Quick Setup: `bunx --bun @cortexkit/magic-context@latest setup` (with --harness flag note) - Doctor section: unified `magic-context doctor` + new pass/warn/fail summary description + DB integrity_check mention - Pi section: `setup --harness pi` and `doctor --harness pi` - Conflict warning: points at unified CLI - Migration note: unified CLI for experimental.* → dreamer.* rewrite - Added @cortexkit/magic-context CLI npm badge - Added Discord badge + nav link (https://discord.gg/F2uWxjGnU) - CONFIGURATION.md: setup wizard description + doctor section both rewritten to use the unified CLI - STRUCTURE.md: entry-point note clarifies CLI lives in packages/cli/, no longer in packages/plugin/src/cli/ - packages/pi-plugin/README.md: install + doctor commands updated; archecture table no longer claims a per-Pi CLI - scripts/install.sh: updated stale comment showing the bun-fallback re-run command - tests/docker/test-pi-e2e.sh: header comment matches the new flag Plugin entries inside JSONC `plugin` arrays correctly stay as `@cortexkit/opencode-magic-context` — that's the runtime plugin package name, not a CLI invocation. Verified: lint + typecheck clean; all stale CLI references in checked-in files now resolved (only refs left are in gitignored .alfonso/.sisyphus/.claude scratch dirs and the gitignored packages/plugin/README.md which is regenerated from this root README at release time).
1 parent 71e67c4 commit 7614c2e

6 files changed

Lines changed: 40 additions & 37 deletions

File tree

CONFIGURATION.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ All settings are flat top-level keys in `magic-context.jsonc`. The schema is **s
1919
| `<project>/.pi/magic-context.jsonc` | Project root |
2020
| `~/.pi/agent/magic-context.jsonc` | User-wide defaults |
2121

22-
Project config always merges on top of user config in both harnesses. The setup wizards (`magic-context-pi setup` for Pi, `bunx ... opencode-magic-context setup` for OpenCode) write the user-level file with sensible defaults.
22+
Project config always merges on top of user config in both harnesses. The unified setup wizard (`bunx --bun @cortexkit/magic-context@latest setup`) auto-detects which harnesses you have installed and writes the user-level file for each with sensible defaults; pass `--harness opencode` or `--harness pi` to target one.
2323

2424
### Cross-harness scoping
2525

@@ -46,21 +46,22 @@ Both setup wizards add this automatically.
4646

4747
### Doctor
4848

49-
If something isn't working, run the appropriate doctor to auto-detect and fix common issues:
49+
If something isn't working, run the unified doctor to auto-detect installed harnesses and fix common issues:
5050

5151
```bash
52-
# OpenCode
53-
bunx --bun @cortexkit/opencode-magic-context@latest doctor
52+
# Auto-detect installed harnesses; if both, picks the first or asks
53+
bunx --bun @cortexkit/magic-context@latest doctor
5454

55-
# Pi
56-
bunx --bun @cortexkit/pi-magic-context@latest doctor
55+
# Target a specific harness explicitly
56+
bunx --bun @cortexkit/magic-context@latest doctor --harness opencode
57+
bunx --bun @cortexkit/magic-context@latest doctor --harness pi
5758
```
5859

59-
The OpenCode doctor checks: installation, plugin registration, `magic-context.jsonc` existence, conflicts (compaction, DCP, OMO hooks), and TUI sidebar configuration.
60+
The OpenCode doctor checks: installation, CLI version vs npm latest, plugin registration (preserves local dev paths), `magic-context.jsonc` parses + loads through the schema, conflicts (compaction, DCP, OMO hooks), TUI sidebar configuration, embedding endpoint, shared-DB existence + `PRAGMA integrity_check` + row counts, plugin npm cache, and historian debug dumps.
6061

61-
The Pi doctor checks: Pi binary + version (requires `>= 0.71.0`), settings registration, config validity, embedding endpoint reachability, shared-DB integrity, and stale Pi extension caches.
62+
The Pi doctor checks: Pi binary + version (requires `>= 0.71.0`), CLI version vs npm latest, settings registration, config validity, embedding endpoint reachability, shared-DB integrity, stale Pi extension caches, and historian debug dumps.
6263

63-
Both auto-fix what they can with `--force` and produce sanitized issue reports with `--issue`.
64+
Both report `PASS X / WARN Y / FAIL Z` summary counts. Use `--force` to auto-fix what doctor can (clears stale plugin cache, repairs config) and `--issue` to produce a sanitized issue report.
6465

6566
---
6667

README.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
</p>
77

88
<p align="center">
9+
<a href="https://www.npmjs.com/package/@cortexkit/magic-context"><img src="https://img.shields.io/npm/v/@cortexkit/magic-context?label=cli&color=orange&style=flat-square" alt="npm @cortexkit/magic-context"></a>
910
<a href="https://www.npmjs.com/package/@cortexkit/opencode-magic-context"><img src="https://img.shields.io/npm/v/@cortexkit/opencode-magic-context?label=opencode&color=blue&style=flat-square" alt="npm @cortexkit/opencode-magic-context"></a>
1011
<a href="https://www.npmjs.com/package/@cortexkit/pi-magic-context"><img src="https://img.shields.io/npm/v/@cortexkit/pi-magic-context?label=pi&color=purple&style=flat-square" alt="npm @cortexkit/pi-magic-context"></a>
12+
<a href="https://discord.gg/F2uWxjGnU"><img src="https://img.shields.io/badge/Discord-Join%20chat-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord"></a>
1113
<a href="https://github.com/cortexkit/magic-context/stargazers"><img src="https://img.shields.io/github/stars/cortexkit/magic-context?style=flat-square&color=yellow" alt="stars"></a>
1214
<a href="https://github.com/cortexkit/magic-context/commits"><img src="https://img.shields.io/github/last-commit/cortexkit/magic-context?style=flat-square&color=green" alt="last commit"></a>
1315
<a href="https://github.com/cortexkit/magic-context/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="MIT License"></a>
@@ -28,7 +30,8 @@
2830
<a href="#how-it-works">How It Works</a> ·
2931
<a href="#magic-context-app">🖥️ Desktop App</a> ·
3032
<a href="#commands">Commands</a> ·
31-
<a href="#configuration">Configuration</a>
33+
<a href="#configuration">Configuration</a> ·
34+
<a href="https://discord.gg/F2uWxjGnU">💬 Discord</a>
3235
</p>
3336

3437
---
@@ -63,7 +66,7 @@ Keep using the **same session** for **weeks**, **months**, or even **years**. **
6366

6467
**Key File Pinning (v0.14)** — under `dreamer.pin_key_files`, still opt-in. Dreamer analyzes which files your agent reads most frequently across the session. Core orientation files (architecture, config, types) that get re-read after every context drop are pinned into the system prompt as `<key-files>`, so the agent always has them without needing to re-read from disk. Files are read fresh on each cache-busting pass. Enable with `dreamer.pin_key_files.enabled: true`.
6568

66-
> Migrating from an earlier version? Running `bunx --bun @cortexkit/opencode-magic-context@latest doctor` rewrites old `experimental.user_memories.*` and `experimental.pin_key_files.*` keys into their new `dreamer.*` homes, preserving any `enabled` state you had.
69+
> Migrating from an earlier version? Running `bunx --bun @cortexkit/magic-context@latest doctor` rewrites old `experimental.user_memories.*` and `experimental.pin_key_files.*` keys into their new `dreamer.*` homes, preserving any `enabled` state you had.
6770
6871
### 🧪 New Experimental Features
6972

@@ -95,11 +98,13 @@ irm https://raw.githubusercontent.com/cortexkit/magic-context/master/scripts/ins
9598

9699
**Or run directly (any OS):**
97100
```bash
98-
bunx --bun @cortexkit/opencode-magic-context@latest setup
101+
bunx --bun @cortexkit/magic-context@latest setup
99102
```
100103

104+
The unified setup wizard auto-detects which harnesses you have installed (OpenCode, Pi, or both) and configures each one. Use `--harness opencode` or `--harness pi` to target a specific harness.
105+
101106
The wizard will:
102-
1. Check your OpenCode installation and available models
107+
1. Detect installed harnesses and available models
103108
2. Add the plugin and disable built-in compaction
104109
3. Help you pick models for historian, dreamer, and sidekick
105110
4. Handle oh-my-opencode compatibility if needed
@@ -161,21 +166,23 @@ The setup wizard handles this automatically if it detects an oh-my-openagent or
161166
Already installed but something isn't working? Run the doctor to check and auto-fix configuration issues:
162167

163168
```bash
164-
bunx --bun @cortexkit/opencode-magic-context@latest doctor
169+
bunx --bun @cortexkit/magic-context@latest doctor
165170
```
166171

167-
Doctor checks for conflicts (compaction, DCP, OMO hooks), ensures the TUI sidebar is configured, verifies the plugin is registered, and checks the npm cache — fixing what it can automatically.
172+
Doctor auto-detects installed harnesses and runs the right checks for each. Pass `--harness opencode` or `--harness pi` to target a specific harness when you have both installed.
173+
174+
Doctor checks for conflicts (compaction, DCP, OMO hooks), ensures the TUI sidebar is configured (OpenCode), verifies the plugin is registered, validates the magic-context.jsonc, runs `PRAGMA integrity_check` on the shared SQLite DB, and checks the npm cache — fixing what it can automatically. The summary line reports `PASS X / WARN Y / FAIL Z` so you can scan results at a glance.
168175

169176
Use `--force` to force-clear the plugin cache even when versions match (fixes broken transitive dependencies):
170177

171178
```bash
172-
bunx --bun @cortexkit/opencode-magic-context@latest doctor --force
179+
bunx --bun @cortexkit/magic-context@latest doctor --force
173180
```
174181

175182
Hit a real bug? Use `--issue` to collect environment, sanitized config, and the last 400 log lines into a ready-to-submit report. It can also open the issue directly via `gh` if you have it installed:
176183

177184
```bash
178-
bunx --bun @cortexkit/opencode-magic-context@latest doctor --issue
185+
bunx --bun @cortexkit/magic-context@latest doctor --issue
179186
```
180187

181188
---
@@ -187,16 +194,16 @@ Magic Context is also available as a [Pi](https://github.com/mariozechner/pi-mon
187194
> ⚠️ The Pi extension is published as **beta** while it accumulates real-world usage. Core flows are validated with end-to-end tests; report issues at [github.com/cortexkit/magic-context/issues](https://github.com/cortexkit/magic-context/issues).
188195
189196
```bash
190-
# Setup wizard for Pi (analogous to the OpenCode flow above)
191-
bunx --bun @cortexkit/pi-magic-context@latest setup
197+
# Setup wizard for Pi (uses the same unified CLI as OpenCode)
198+
bunx --bun @cortexkit/magic-context@latest setup --harness pi
192199
```
193200

194201
Requires Pi `>= 0.71.0`. The wizard handles registration with Pi (`packages` array in `~/.pi/agent/settings.json`), writes `~/.pi/agent/magic-context.jsonc`, and prompts for historian/dreamer/sidekick model picks. Pi-specific docs and config notes live in [`packages/pi-plugin/README.md`](https://github.com/cortexkit/magic-context/blob/master/packages/pi-plugin/README.md).
195202

196203
For health checks:
197204

198205
```bash
199-
bunx --bun @cortexkit/pi-magic-context@latest doctor
206+
bunx --bun @cortexkit/magic-context@latest doctor --harness pi
200207
```
201208

202209
---
@@ -358,7 +365,7 @@ The TUI plugin is configured automatically by the setup wizard and the `doctor`
358365

359366
### Startup conflict detection
360367

361-
On startup, Magic Context checks for common configuration problems — OpenCode's built-in compaction being enabled, DCP plugin being active alongside Magic Context, or conflicting oh-my-openagent hooks. When conflicts are detected, it warns the active session with a fix suggestion pointing to `bunx --bun @cortexkit/opencode-magic-context@latest doctor`.
368+
On startup, Magic Context checks for common configuration problems — OpenCode's built-in compaction being enabled, DCP plugin being active alongside Magic Context, or conflicting oh-my-openagent hooks. When conflicts are detected, it warns the active session with a fix suggestion pointing to `bunx --bun @cortexkit/magic-context@latest doctor`.
362369

363370
---
364371

STRUCTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
## Key File Locations
7777

78-
**Entry Points:** `src/index.ts`: Register the plugin, hidden agents, hooks, tools, and commands. `src/cli/index.ts`: CLI binary entry for `bunx --bun @cortexkit/opencode-magic-context setup`.
78+
**Entry Points:** `src/index.ts`: Register the plugin, hidden agents, hooks, tools, and commands. The CLI now lives in the separate `@cortexkit/magic-context` package (`packages/cli/`) — see `packages/cli/src/index.ts` for the unified setup/doctor/migrate entry.
7979

8080
**Configuration:** `src/config/index.ts`: Load and merge config files; `src/config/schema/magic-context.ts`: define defaults and schema rules.
8181

packages/pi-plugin/README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ Magic Context is a context engine that keeps long Pi sessions productive by:
2828

2929
## Installation
3030

31-
The fastest path is the interactive setup wizard — it registers the extension with Pi, writes a sensible `magic-context.jsonc`, and verifies your model picks against Pi's CLI:
31+
The fastest path is the unified Magic Context CLI — `--harness pi` selects the Pi-specific setup pipeline (registers the extension with Pi, writes a sensible `magic-context.jsonc`, and verifies your model picks):
3232

3333
```bash
34-
bunx --bun @cortexkit/pi-magic-context@latest setup
34+
bunx --bun @cortexkit/magic-context@latest setup --harness pi
3535
```
3636

3737
This handles everything for you:
@@ -40,24 +40,18 @@ This handles everything for you:
4040
3. Prompts you for historian, dreamer, sidekick, and embedding model choices
4141
4. Warns about provider-specific gotchas (e.g. GitHub Copilot reasoning models need an explicit `thinking_level`)
4242

43-
If you'd rather install the npm package globally first:
44-
45-
```bash
46-
npm install -g @cortexkit/pi-magic-context@latest
47-
# or
48-
bun add -g @cortexkit/pi-magic-context@latest
49-
```
50-
51-
Then either run `magic-context-pi setup` or register the extension manually with Pi's own installer:
43+
If you'd rather register the Pi extension package directly with Pi (skipping the wizard), use Pi's own installer:
5244

5345
```bash
5446
pi install npm:@cortexkit/pi-magic-context
5547
```
5648

49+
This adds the extension to `~/.pi/agent/settings.json` but won't write `magic-context.jsonc` for you — you'll need to create it manually (see Configuration below).
50+
5751
To check installation health later:
5852

5953
```bash
60-
magic-context-pi doctor
54+
bunx --bun @cortexkit/magic-context@latest doctor --harness pi
6155
```
6256

6357
---
@@ -161,7 +155,8 @@ This package is part of the [magic-context monorepo](https://github.com/cortexki
161155
| `dreamer/` | Pi-side adapter for the shared dreamer scheduler |
162156
| `system-prompt.ts` | Pi `before_agent_start` injector for `<session-history>`, `<project-memory>`, `<project-docs>` |
163157
| `config/` | Pi-convention config loader (`$cwd/.pi/magic-context.jsonc` + `~/.pi/agent/magic-context.jsonc`) |
164-
| `cli/` | `magic-context-pi setup` and `magic-context-pi doctor` |
158+
159+
The CLI lives in the unified [`@cortexkit/magic-context`](https://www.npmjs.com/package/@cortexkit/magic-context) package — `setup --harness pi` and `doctor --harness pi` route to the Pi-specific code paths in `packages/cli/src/commands/`.
165160

166161
For deeper architectural detail, see the main repo's [ARCHITECTURE.md](https://github.com/cortexkit/magic-context/blob/master/ARCHITECTURE.md).
167162

scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ main() {
5656
# Bun is installed but Node is missing or too old. Force the bun runtime
5757
# as a last resort; interactive select prompts may not work under
5858
# curl | bash in this path. Users can re-run directly with:
59-
# bunx --bun @cortexkit/opencode-magic-context@latest setup
59+
# bunx --bun @cortexkit/magic-context@latest setup
6060
echo " ⚠ Node $MIN_NODE_MAJOR.$MIN_NODE_MINOR+ is required for the piped installer."
6161
echo " Falling back to Bun runtime — if the historian model picker freezes,"
6262
echo " re-run directly:"

tests/docker/test-pi-e2e.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Magic Context — Pi E2E test runner (runs inside Docker).
44
#
55
# Two scenarios:
6-
# SETUP_SMOKE — fresh-install path via `magic-context-pi doctor --force`
6+
# SETUP_SMOKE — fresh-install path via `magic-context doctor --harness pi --force`
77
# SESSION_SMOKE — single-turn `pi --print --mode json` against aimock
88
#
99
# Both assertions check the shared SQLite DB at

0 commit comments

Comments
 (0)